home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 June: Reference Library / Dev.CD Jun 95 / Dev.CD Jun 95.toast / Technical Documentation / Mac Tech Notes (DocViewer) / DV • Devices / DV23 Driver Education < prev    next >
MacBinary  |  1995-01-24  |  151.9 KB  |  [ONLN/HLX2]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
1% dexvert MacBinary (archive/macBinary) fallback Supported
100% file MacBinary II, inited, Tue Jan 24 05:04:36 1995, modified Tue Jan 24 15:35:56 1995, creator 'HLX2', type 'ONLN', 151819 bytes "DV23 Driver Education" , at 0x2518b 3391 bytes resource default (weak)
99% file data default
100% TrID MacBinary 2 default (weak)
100% dearkID deark: macbinary default
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[ONLN]
macFileCreator[HLX2]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 15 44 56 32 33 20 44 | 72 69 76 65 72 20 45 64 |..DV23 D|river Ed|
|00000010| 75 63 61 74 69 6f 6e 00 | 00 00 00 00 00 00 00 00 |ucation.|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 4f 4e 4c 4e 48 4c 58 | 32 01 00 00 00 00 00 00 |.ONLNHLX|2.......|
|00000050| 00 00 00 00 02 51 0b 00 | 00 0d 3f ab 4a 81 34 ab |.....Q..|..?.J.4.|
|00000060| 4b 15 2c 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |K.,.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 ad b3 00 00 |........|........|
|00000080| 44 56 20 32 33 20 2d 20 | 44 72 69 76 65 72 20 45 |DV 23 - |Driver E|
|00000090| 64 75 63 61 74 69 6f 6e | 0d 44 65 76 69 63 65 73 |ducation|.Devices|
|000000a0| 09 09 09 09 0d 52 65 76 | 69 73 65 64 20 62 79 20 |.....Rev|ised by |
|000000b0| 09 43 72 61 69 67 20 50 | 72 6f 75 73 65 20 26 20 |.Craig P|rouse & |
|000000c0| 42 72 69 61 6e 20 42 65 | 63 68 74 65 6c 09 46 65 |Brian Be|chtel.Fe|
|000000d0| 62 72 75 61 72 79 20 31 | 39 39 33 0d 57 72 69 74 |bruary 1|993.Writ|
|000000e0| 74 65 6e 20 62 79 3a 09 | 4d 61 72 6b 20 42 65 6e |ten by:.|Mark Ben|
|000000f0| 6e 65 74 74 09 41 75 67 | 75 73 74 20 31 39 39 30 |nett.Aug|ust 1990|
|00000100| 0d 54 68 69 73 20 54 65 | 63 68 6e 69 63 61 6c 20 |.This Te|chnical |
|00000110| 4e 6f 74 65 20 64 65 73 | 63 72 69 62 65 73 20 69 |Note des|cribes i|
|00000120| 6e 20 64 65 74 61 69 6c | 20 74 68 65 20 6f 70 65 |n detail| the ope|
|00000130| 72 61 74 69 6f 6e 20 6f | 66 20 74 68 65 20 44 65 |ration o|f the De|
|00000140| 76 69 63 65 20 4d 61 6e | 61 67 65 72 20 61 6e 64 |vice Man|ager and|
|00000150| 20 69 74 73 20 69 6e 74 | 65 72 61 63 74 69 6f 6e | its int|eraction|
|00000160| 20 77 69 74 68 20 64 65 | 76 69 63 65 20 64 72 69 | with de|vice dri|
|00000170| 76 65 72 73 2e 20 49 74 | 20 70 72 6f 76 69 64 65 |vers. It| provide|
|00000180| 73 20 74 68 65 20 62 61 | 63 6b 67 72 6f 75 6e 64 |s the ba|ckground|
|00000190| 20 6e 65 65 64 65 64 20 | 66 6f 72 20 63 6f 72 72 | needed |for corr|
|000001a0| 65 63 74 20 6f 70 65 72 | 61 74 69 6f 6e 20 6f 66 |ect oper|ation of|
|000001b0| 20 74 68 69 72 64 2d 70 | 61 72 74 79 20 64 65 76 | third-p|arty dev|
|000001c0| 69 63 65 20 64 72 69 76 | 65 72 73 20 61 6e 64 20 |ice driv|ers and |
|000001d0| 61 6c 73 6f 20 70 72 65 | 73 65 6e 74 73 20 61 20 |also pre|sents a |
|000001e0| 6d 65 74 68 6f 64 20 66 | 6f 72 20 66 69 6e 64 69 |method f|or findi|
|000001f0| 6e 67 20 61 6e 20 65 6e | 74 72 79 20 69 6e 20 74 |ng an en|try in t|
|00000200| 68 65 20 55 6e 69 74 20 | 54 61 62 6c 65 20 66 6f |he Unit |Table fo|
|00000210| 72 20 61 20 64 72 69 76 | 65 72 2e 0d 4d 61 6e 79 |r a driv|er..Many|
|00000220| 20 61 73 70 65 63 74 73 | 20 6f 66 20 74 68 65 20 | aspects| of the |
|00000230| 44 65 76 69 63 65 20 4d | 61 6e 61 67 65 72 20 72 |Device M|anager r|
|00000240| 65 6d 61 69 6e 20 6d 79 | 73 74 65 72 69 6f 75 73 |emain my|sterious|
|00000250| 20 74 6f 20 65 76 65 6e | 20 74 68 65 20 6d 6f 73 | to even| the mos|
|00000260| 74 20 73 74 75 64 69 6f | 75 73 20 6f 66 20 4d 61 |t studio|us of Ma|
|00000270| 63 69 6e 74 6f 73 68 20 | 64 65 76 65 6c 6f 70 65 |cintosh |develope|
|00000280| 72 73 2c 20 65 73 70 65 | 63 69 61 6c 6c 79 20 74 |rs, espe|cially t|
|00000290| 68 6f 73 65 20 77 68 6f | 20 6d 69 67 68 74 20 77 |hose who| might w|
|000002a0| 69 73 68 20 74 6f 20 61 | 63 63 6f 6d 70 6c 69 73 |ish to a|ccomplis|
|000002b0| 68 20 74 61 73 6b 73 20 | 6e 6f 74 20 64 69 72 65 |h tasks |not dire|
|000002c0| 63 74 6c 79 20 73 75 70 | 70 6f 72 74 65 64 20 62 |ctly sup|ported b|
|000002d0| 79 20 74 68 65 20 63 75 | 72 72 65 6e 74 20 6f 66 |y the cu|rrent of|
|000002e0| 66 65 72 69 6e 67 20 6f | 66 20 63 61 6c 6c 73 2e |fering o|f calls.|
|000002f0| 20 46 6f 72 20 65 78 61 | 6d 70 6c 65 2c 20 61 20 | For exa|mple, a |
|00000300| 64 65 76 65 6c 6f 70 65 | 72 20 6d 69 67 68 74 20 |develope|r might |
|00000310| 77 69 73 68 20 74 6f 20 | 69 6e 73 74 61 6c 6c 20 |wish to |install |
|00000320| 74 68 65 69 72 20 6f 77 | 6e 20 64 72 69 76 65 72 |their ow|n driver|
|00000330| 20 61 74 20 49 4e 49 54 | 20 74 69 6d 65 20 6f 72 | at INIT| time or|
|00000340| 20 77 69 73 68 20 74 6f | 20 6d 61 6e 61 67 65 20 | wish to| manage |
|00000350| 74 68 65 69 72 20 6f 77 | 6e 20 49 2f 4f 20 71 75 |their ow|n I/O qu|
|00000360| 65 75 65 73 20 66 6f 72 | 20 70 72 6f 63 65 73 73 |eues for| process|
|00000370| 69 6e 67 2e 20 41 20 73 | 6f 6c 69 64 20 6b 6e 6f |ing. A s|olid kno|
|00000380| 77 6c 65 64 67 65 20 6f | 66 20 74 68 65 20 44 65 |wledge o|f the De|
|00000390| 76 69 63 65 20 4d 61 6e | 61 67 65 72 20 68 65 6c |vice Man|ager hel|
|000003a0| 70 73 20 69 6e 20 74 68 | 65 73 65 20 74 61 73 6b |ps in th|ese task|
|000003b0| 73 2c 20 61 73 20 77 65 | 6c 6c 20 61 73 20 69 6e |s, as we|ll as in|
|000003c0| 20 73 69 6d 70 6c 79 20 | 77 72 69 74 69 6e 67 20 | simply |writing |
|000003d0| 61 20 6e 6f 72 6d 61 6c | 2c 20 6e 6f 2d 66 72 69 |a normal|, no-fri|
|000003e0| 6c 6c 73 20 64 65 76 69 | 63 65 20 64 72 69 76 65 |lls devi|ce drive|
|000003f0| 72 2e 0d 41 20 67 65 6e | 65 72 61 6c 2d 75 73 61 |r..A gen|eral-usa|
|00000400| 67 65 20 64 72 69 76 65 | 72 2c 20 77 68 69 63 68 |ge drive|r, which|
|00000410| 20 69 73 20 62 65 73 74 | 20 69 6e 73 74 61 6c 6c | is best| install|
|00000420| 65 64 20 61 74 20 49 4e | 49 54 20 74 69 6d 65 2c |ed at IN|IT time,|
|00000430| 20 70 72 6f 76 69 64 65 | 73 20 73 65 72 76 69 63 | provide|s servic|
|00000440| 65 73 20 74 6f 20 73 6f | 66 74 77 61 72 65 20 74 |es to so|ftware t|
|00000450| 68 61 74 20 6d 69 67 68 | 74 20 72 75 6e 20 6f 6e |hat migh|t run on|
|00000460| 20 61 20 4d 61 63 69 6e | 74 6f 73 68 20 61 74 20 | a Macin|tosh at |
|00000470| 61 6e 79 20 74 69 6d 65 | 2e 20 54 68 69 73 20 74 |any time|. This t|
|00000480| 79 70 65 20 6f 66 20 64 | 72 69 76 65 72 20 69 73 |ype of d|river is|
|00000490| 20 74 79 70 69 63 61 6c | 6c 79 20 69 6d 70 6c 65 | typical|ly imple|
|000004a0| 6d 65 6e 74 65 64 20 62 | 79 20 68 61 76 69 6e 67 |mented b|y having|
|000004b0| 20 61 20 66 69 6c 65 20 | 6f 66 20 74 79 70 65 20 | a file |of type |
|000004c0| d2 49 4e 49 54 d3 2c 20 | d2 43 44 45 56 d3 2c 20 |.INIT., |.CDEV., |
|000004d0| 6f 72 20 d2 52 44 45 56 | d3 20 74 68 61 74 20 75 |or .RDEV|. that u|
|000004e0| 73 65 72 73 20 6d 6f 76 | 65 20 69 6e 74 6f 20 74 |sers mov|e into t|
|000004f0| 68 65 69 72 20 53 79 73 | 74 65 6d 20 46 6f 6c 64 |heir Sys|tem Fold|
|00000500| 65 72 2e 20 54 68 69 73 | 20 66 69 6c 65 20 63 6f |er. This| file co|
|00000510| 6e 74 61 69 6e 73 20 27 | 49 4e 49 54 27 20 61 6e |ntains '|INIT' an|
|00000520| 64 20 27 44 52 56 52 27 | 20 72 65 73 6f 75 72 63 |d 'DRVR'| resourc|
|00000530| 65 73 2c 20 61 6d 6f 6e | 67 20 6f 74 68 65 72 73 |es, amon|g others|
|00000540| 2e 20 54 68 65 20 27 49 | 4e 49 54 27 20 72 65 73 |. The 'I|NIT' res|
|00000550| 6f 75 72 63 65 20 67 65 | 74 73 20 6c 6f 61 64 65 |ource ge|ts loade|
|00000560| 64 20 69 6e 74 6f 20 6d | 65 6d 6f 72 79 20 61 6e |d into m|emory an|
|00000570| 64 20 65 78 65 63 75 74 | 65 64 2c 20 61 74 20 77 |d execut|ed, at w|
|00000580| 68 69 63 68 20 74 69 6d | 65 20 69 74 20 69 6e 73 |hich tim|e it ins|
|00000590| 74 61 6c 6c 73 20 74 68 | 65 20 64 72 69 76 65 72 |talls th|e driver|
|000005a0| 2e 0d 43 61 76 65 61 74 | 20 4c 6f 77 20 4d 65 6d |..Caveat| Low Mem|
|000005b0| 6f 72 79 20 65 74 20 53 | 79 73 74 65 6d 20 44 61 |ory et S|ystem Da|
|000005c0| 74 61 20 53 74 72 75 63 | 74 75 72 65 73 0d 57 61 |ta Struc|tures.Wa|
|000005d0| 72 6e 69 6e 67 3a 09 54 | 68 69 73 20 4e 6f 74 65 |rning:.T|his Note|
|000005e0| 20 69 6e 76 6f 6c 76 65 | 73 20 74 68 65 20 64 69 | involve|s the di|
|000005f0| 73 63 75 73 73 69 6f 6e | 20 61 6e 64 20 75 73 65 |scussion| and use|
|00000600| 20 6f 66 20 6c 6f 77 2d | 6d 65 6d 6f 72 79 20 67 | of low-|memory g|
|00000610| 6c 6f 62 61 6c 73 20 61 | 6e 64 20 6f 70 65 72 61 |lobals a|nd opera|
|00000620| 74 69 6e 67 20 73 79 73 | 74 65 6d 73 20 69 6e 74 |ting sys|tems int|
|00000630| 65 72 6e 61 6c 20 64 61 | 74 61 20 73 74 72 75 63 |ernal da|ta struc|
|00000640| 74 75 72 65 73 2e 20 49 | 74 20 69 73 20 61 20 70 |tures. I|t is a p|
|00000650| 6c 61 69 6e 20 66 61 63 | 74 20 74 68 61 74 20 75 |lain fac|t that u|
|00000660| 73 69 6e 67 20 74 68 65 | 73 65 20 70 75 74 73 20 |sing the|se puts |
|00000670| 73 6f 66 74 77 61 72 65 | 20 61 74 20 61 20 63 6f |software| at a co|
|00000680| 6d 70 61 74 69 62 69 6c | 69 74 79 20 72 69 73 6b |mpatibil|ity risk|
|00000690| 3b 20 74 68 65 72 65 66 | 6f 72 65 2c 20 44 54 53 |; theref|ore, DTS|
|000006a0| 20 72 65 63 6f 6d 6d 65 | 6e 64 73 20 79 6f 75 20 | recomme|nds you |
|000006b0| 61 70 70 72 6f 61 63 68 | 20 74 68 65 20 69 6e 66 |approach| the inf|
|000006c0| 6f 72 6d 61 74 69 6f 6e | 20 69 6e 20 74 68 69 73 |ormation| in this|
|000006d0| 20 4e 6f 74 65 20 69 6e | 20 74 68 65 20 66 6f 6c | Note in| the fol|
|000006e0| 6c 6f 77 69 6e 67 20 6d | 61 6e 6e 65 72 3a 0d 31 |lowing m|anner:.1|
|000006f0| 2e 09 49 66 20 79 6f 75 | 20 64 6f 20 6e 6f 74 20 |..If you| do not |
|00000700| 68 61 76 65 20 74 6f 20 | 75 73 65 20 61 20 6c 6f |have to |use a lo|
|00000710| 77 2d 6d 65 6d 6f 72 79 | 20 67 6c 6f 62 61 6c 20 |w-memory| global |
|00000720| 6f 72 20 73 79 73 74 65 | 6d 20 64 61 74 61 20 73 |or syste|m data s|
|00000730| 74 72 75 63 74 75 72 65 | 2c 20 74 68 65 6e 20 64 |tructure|, then d|
|00000740| 6f 6e d5 74 2e 0d 32 2e | 09 49 66 20 79 6f 75 20 |on.t..2.|.If you |
|00000750| 64 6f 20 68 61 76 65 20 | 74 6f 20 75 73 65 20 61 |do have |to use a|
|00000760| 20 6c 6f 77 2d 6d 65 6d | 6f 72 79 20 67 6c 6f 62 | low-mem|ory glob|
|00000770| 61 6c 20 6f 72 20 73 79 | 73 74 65 6d 20 64 61 74 |al or sy|stem dat|
|00000780| 61 20 73 74 72 75 63 74 | 75 72 65 2c 20 75 73 65 |a struct|ure, use|
|00000790| 20 69 74 20 6f 6e 6c 79 | 20 61 73 20 64 65 73 63 | it only| as desc|
|000007a0| 72 69 62 65 64 20 69 6e | 20 74 68 69 73 20 4e 6f |ribed in| this No|
|000007b0| 74 65 2c 20 6f 72 20 69 | 6e 20 6f 74 68 65 72 2c |te, or i|n other,|
|000007c0| 20 61 75 74 68 6f 72 69 | 7a 65 64 20 41 70 70 6c | authori|zed Appl|
|000007d0| 65 20 43 6f 6d 70 75 74 | 65 72 2c 20 49 6e 63 2e |e Comput|er, Inc.|
|000007e0| 20 74 65 63 68 6e 69 63 | 61 6c 20 64 6f 63 75 6d | technic|al docum|
|000007f0| 65 6e 74 61 74 69 6f 6e | 2e 0d 33 2e 09 57 68 65 |entation|..3..Whe|
|00000800| 6e 20 75 73 69 6e 67 20 | 61 20 6c 6f 77 2d 6d 65 |n using |a low-me|
|00000810| 6d 6f 72 79 20 67 6c 6f | 62 61 6c 20 6f 72 20 73 |mory glo|bal or s|
|00000820| 79 73 74 65 6d 20 64 61 | 74 61 20 73 74 72 75 63 |ystem da|ta struc|
|00000830| 74 75 72 65 20 69 6e 20 | 61 6e 20 61 75 74 68 6f |ture in |an autho|
|00000840| 72 69 7a 65 64 20 6d 61 | 6e 6e 65 72 2c 20 64 6f |rized ma|nner, do|
|00000850| 20 73 6f 20 69 6e 20 61 | 20 77 61 79 20 74 68 61 | so in a| way tha|
|00000860| 74 20 65 6e 63 61 70 73 | 75 6c 61 74 65 73 20 61 |t encaps|ulates a|
|00000870| 6e 64 20 69 73 6f 6c 61 | 74 65 73 20 74 68 69 73 |nd isola|tes this|
|00000880| 20 64 65 70 65 6e 64 65 | 6e 63 79 20 66 72 6f 6d | depende|ncy from|
|00000890| 20 74 68 65 20 72 65 73 | 74 20 6f 66 20 74 68 69 | the res|t of thi|
|000008a0| 73 20 73 6f 66 74 77 61 | 72 65 2e 20 54 68 69 73 |s softwa|re. This|
|000008b0| 20 77 61 79 2c 20 69 66 | 20 41 70 70 6c 65 20 61 | way, if| Apple a|
|000008c0| 6c 74 65 72 73 20 74 68 | 65 20 73 74 72 75 63 74 |lters th|e struct|
|000008d0| 75 72 65 20 6f 66 20 73 | 70 61 63 65 2d 74 69 6d |ure of s|pace-tim|
|000008e0| 65 20 6f 75 74 20 66 72 | 6f 6d 20 75 6e 64 65 72 |e out fr|om under|
|000008f0| 20 79 6f 75 2c 20 74 68 | 65 72 65 20 69 73 20 6f | you, th|ere is o|
|00000900| 6e 65 20 6e 69 63 65 2c | 20 74 69 64 79 20 73 70 |ne nice,| tidy sp|
|00000910| 6f 74 20 74 68 61 74 20 | 79 6f 75 20 68 61 76 65 |ot that |you have|
|00000920| 20 74 6f 20 6d 6f 64 69 | 66 79 2e 0d 34 2e 09 57 | to modi|fy..4..W|
|00000930| 68 65 6e 20 41 70 70 6c | 65 20 70 72 6f 76 69 64 |hen Appl|e provid|
|00000940| 65 73 20 61 20 73 79 73 | 74 65 6d 2d 69 6e 64 65 |es a sys|tem-inde|
|00000950| 70 65 6e 64 65 6e 74 20 | 6d 61 6e 6e 65 72 20 62 |pendent |manner b|
|00000960| 79 20 77 68 69 63 68 20 | 79 6f 75 20 63 61 6e 20 |y which |you can |
|00000970| 6f 62 74 61 69 6e 20 74 | 68 65 20 73 61 6d 65 20 |obtain t|he same |
|00000980| 69 6e 66 6f 72 6d 61 74 | 69 6f 6e 2c 20 6d 6f 64 |informat|ion, mod|
|00000990| 69 66 79 20 79 6f 75 72 | 20 63 6f 64 65 20 74 6f |ify your| code to|
|000009a0| 20 75 73 65 20 74 68 69 | 73 20 6d 65 74 68 6f 64 | use thi|s method|
|000009b0| 2e 0d 09 41 6e 20 65 78 | 61 6d 70 6c 65 20 6f 66 |...An ex|ample of|
|000009c0| 20 70 6f 69 6e 74 73 20 | 74 68 72 65 65 20 61 6e | points |three an|
|000009d0| 64 20 66 6f 75 72 20 77 | 6f 75 6c 64 20 62 65 20 |d four w|ould be |
|000009e0| 75 73 69 6e 67 20 61 20 | 6d 6f 64 75 6c 65 20 74 |using a |module t|
|000009f0| 68 61 74 20 72 65 74 75 | 72 6e 73 20 61 20 6c 6f |hat retu|rns a lo|
|00000a00| 77 2d 6d 65 6d 6f 72 79 | 20 67 6c 6f 62 61 6c 20 |w-memory| global |
|00000a10| 69 6e 73 74 65 61 64 20 | 6f 66 20 61 6c 77 61 79 |instead |of alway|
|00000a20| 73 20 72 65 61 63 68 69 | 6e 67 20 69 6e 74 6f 20 |s reachi|ng into |
|00000a30| 6c 6f 77 2d 6d 65 6d 6f | 72 79 20 64 69 72 65 63 |low-memo|ry direc|
|00000a40| 74 6c 79 2e 20 46 6f 72 | 20 65 78 61 6d 70 6c 65 |tly. For| example|
|00000a50| 2c 20 77 68 65 6e 20 74 | 68 69 73 20 4e 6f 74 65 |, when t|his Note|
|00000a60| 20 72 65 66 65 72 65 6e | 63 65 73 20 74 68 65 20 | referen|ces the |
|00000a70| 6c 6f 77 2d 6d 65 6d 6f | 72 79 20 67 6c 6f 62 61 |low-memo|ry globa|
|00000a80| 6c 20 55 54 61 62 6c 65 | 42 61 73 65 2c 20 74 68 |l UTable|Base, th|
|00000a90| 65 20 73 6f 66 74 77 61 | 72 65 20 74 68 61 74 20 |e softwa|re that |
|00000aa0| 6e 65 65 64 73 20 74 68 | 65 20 76 61 6c 75 65 20 |needs th|e value |
|00000ab0| 73 74 6f 72 65 64 20 74 | 68 65 72 65 20 73 68 6f |stored t|here sho|
|00000ac0| 75 6c 64 20 63 61 6c 6c | 20 61 20 72 6f 75 74 69 |uld call| a routi|
|00000ad0| 6e 65 20 6c 69 6b 65 20 | 74 68 65 20 66 6f 6c 6c |ne like |the foll|
|00000ae0| 6f 77 69 6e 67 3a 0d 20 | 20 20 20 20 20 20 20 20 |owing:. | |
|00000af0| 20 20 20 20 20 46 55 4e | 43 54 49 4f 4e 20 47 65 | FUN|CTION Ge|
|00000b00| 74 55 54 61 62 6c 65 42 | 61 73 65 20 3a 20 50 74 |tUTableB|ase : Pt|
|00000b10| 72 3b 0d 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |r;. | |
|00000b20| 20 43 4f 4e 53 54 0d 20 | 20 20 20 20 20 20 20 20 | CONST. | |
|00000b30| 20 20 20 20 20 20 20 20 | 20 55 54 61 62 6c 65 42 | | UTableB|
|00000b40| 61 73 65 20 3d 20 24 31 | 31 43 3b 0d 20 20 20 20 |ase = $1|1C;. |
|00000b50| 20 20 20 20 20 20 20 20 | 20 20 54 59 50 45 0d 20 | | TYPE. |
|00000b60| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000b70| 20 4c 6f 6e 67 50 74 72 | 20 3d 20 5e 4c 6f 6e 67 | LongPtr| = ^Long|
|00000b80| 49 6e 74 3b 0d 20 20 20 | 20 20 20 20 20 20 20 20 |Int;. | |
|00000b90| 20 20 20 42 45 47 49 4e | 0d 20 20 20 20 20 20 20 | BEGIN|. |
|00000ba0| 20 20 20 20 20 20 20 20 | 20 20 20 47 65 74 55 54 | | GetUT|
|00000bb0| 61 62 6c 65 42 61 73 65 | 20 3a 3d 20 50 4f 49 4e |ableBase| := POIN|
|00000bc0| 54 45 52 28 4c 6f 6e 67 | 50 74 72 28 55 54 61 62 |TER(Long|Ptr(UTab|
|00000bd0| 6c 65 42 61 73 65 29 5e | 29 3b 0d 20 20 20 20 20 |leBase)^|);. |
|00000be0| 20 20 20 20 20 20 20 20 | 20 45 4e 44 3b 0d 09 54 | | END;..T|
|00000bf0| 68 65 6e 2c 20 69 66 20 | 41 70 70 6c 65 20 77 65 |hen, if |Apple we|
|00000c00| 72 65 20 74 6f 20 70 72 | 6f 76 69 64 65 20 61 20 |re to pr|ovide a |
|00000c10| 47 65 73 74 61 6c 74 20 | 63 61 6c 6c 20 74 6f 20 |Gestalt |call to |
|00000c20| 67 65 74 20 74 68 65 20 | 73 61 6d 65 20 76 61 6c |get the |same val|
|00000c30| 75 65 2c 20 6f 6e 6c 79 | 20 74 68 69 73 20 6f 6e |ue, only| this on|
|00000c40| 65 20 6d 6f 64 75 6c 65 | 20 77 6f 75 6c 64 20 28 |e module| would (|
|00000c50| 61 6e 64 20 73 68 6f 75 | 6c 64 29 20 62 65 20 63 |and shou|ld) be c|
|00000c60| 68 61 6e 67 65 64 2e 20 | 49 66 20 79 6f 75 20 61 |hanged. |If you a|
|00000c70| 72 65 20 62 6c 65 73 73 | 65 64 20 65 6e 6f 75 67 |re bless|ed enoug|
|00000c80| 68 20 74 6f 20 62 65 20 | 75 73 69 6e 67 20 61 20 |h to be |using a |
|00000c90| 68 69 67 68 2d 6c 65 76 | 65 6c 20 6f 72 2c 20 62 |high-lev|el or, b|
|00000ca0| 65 74 74 65 72 20 79 65 | 74 2c 20 61 6e 20 6f 62 |etter ye|t, an ob|
|00000cb0| 6a 65 63 74 2d 6f 72 69 | 65 6e 74 65 64 20 6c 61 |ject-ori|ented la|
|00000cc0| 6e 67 75 61 67 65 2c 20 | 79 6f 75 20 63 61 6e 20 |nguage, |you can |
|00000cd0| 65 76 65 6e 20 66 75 72 | 74 68 65 72 20 69 73 6f |even fur|ther iso|
|00000ce0| 6c 61 74 65 20 74 68 65 | 20 64 65 70 65 6e 64 65 |late the| depende|
|00000cf0| 6e 63 79 20 62 79 20 65 | 6e 63 61 70 73 75 6c 61 |ncy by e|ncapsula|
|00000d00| 74 69 6e 67 20 61 20 77 | 68 6f 6c 65 20 6d 65 63 |ting a w|hole mec|
|00000d10| 68 61 6e 69 73 6d 20 74 | 68 61 74 20 72 65 6c 69 |hanism t|hat reli|
|00000d20| 65 73 20 6f 6e 20 6c 6f | 77 2d 6d 65 6d 6f 72 79 |es on lo|w-memory|
|00000d30| 20 67 6c 6f 62 61 6c 73 | 20 61 6e 64 20 73 79 73 | globals| and sys|
|00000d40| 74 65 6d 20 64 61 74 61 | 20 73 74 72 75 63 74 75 |tem data| structu|
|00000d50| 72 65 73 20 69 6e 74 6f | 20 61 20 6d 6f 64 75 6c |res into| a modul|
|00000d60| 65 20 74 68 61 74 20 63 | 61 6e 20 62 65 20 63 6f |e that c|an be co|
|00000d70| 6d 70 6c 65 74 65 6c 79 | 20 72 65 70 6c 61 63 65 |mpletely| replace|
|00000d80| 64 20 69 66 20 6e 65 65 | 64 65 64 2e 0d 09 49 74 |d if nee|ded...It|
|00000d90| 20 73 68 6f 75 6c 64 20 | 67 6f 20 77 69 74 68 6f | should |go witho|
|00000da0| 75 74 20 73 61 79 69 6e | 67 20 74 68 61 74 20 73 |ut sayin|g that s|
|00000db0| 69 6d 70 6c 79 20 62 65 | 63 61 75 73 65 20 74 68 |imply be|cause th|
|00000dc0| 69 73 20 4e 6f 74 65 20 | 75 73 65 73 20 73 6f 6d |is Note |uses som|
|00000dd0| 65 20 6c 6f 77 2d 6d 65 | 6d 6f 72 79 20 67 6c 6f |e low-me|mory glo|
|00000de0| 62 61 6c 73 20 61 6e 64 | 20 73 79 73 74 65 6d 20 |bals and| system |
|00000df0| 64 61 74 61 20 73 74 72 | 75 63 74 75 72 65 73 2c |data str|uctures,|
|00000e00| 20 69 74 20 64 6f 65 73 | 20 6e 6f 74 20 6d 65 61 | it does| not mea|
|00000e10| 6e 20 41 70 70 6c 65 20 | 68 61 73 20 67 6f 6e 65 |n Apple |has gone|
|00000e20| 20 73 6f 66 74 20 6f 6e | 20 73 6f 66 74 77 61 72 | soft on| softwar|
|00000e30| 65 20 74 68 61 74 20 75 | 73 65 73 20 74 68 65 6d |e that u|ses them|
|00000e40| 2c 20 65 73 70 65 63 69 | 61 6c 6c 79 20 77 68 65 |, especi|ally whe|
|00000e50| 6e 20 74 68 65 79 20 76 | 69 6f 6c 61 74 65 20 74 |n they v|iolate t|
|00000e60| 68 65 20 61 66 6f 72 65 | 6d 65 6e 74 69 6f 6e 65 |he afore|mentione|
|00000e70| 64 20 67 75 69 64 65 6c | 69 6e 65 73 2e 0d 44 72 |d guidel|ines..Dr|
|00000e80| 69 76 65 6e 20 54 6f 20 | 54 65 61 72 73 0d 41 20 |iven To |Tears.A |
|00000e90| 73 6f 6c 69 64 20 75 6e | 64 65 72 73 74 61 6e 64 |solid un|derstand|
|00000ea0| 69 6e 67 20 6f 66 20 74 | 68 65 20 44 65 76 69 63 |ing of t|he Devic|
|00000eb0| 65 20 4d 61 6e 61 67 65 | 72 20 62 65 67 69 6e 73 |e Manage|r begins|
|00000ec0| 20 77 69 74 68 20 6b 6e | 6f 77 6c 65 64 67 65 20 | with kn|owledge |
|00000ed0| 6f 66 20 69 74 73 20 64 | 61 74 61 20 73 74 72 75 |of its d|ata stru|
|00000ee0| 63 74 75 72 65 73 2e 20 | 41 6c 74 68 6f 75 67 68 |ctures. |Although|
|00000ef0| 20 6d 75 63 68 20 6f 66 | 20 74 68 65 20 66 6f 6c | much of| the fol|
|00000f00| 6c 6f 77 69 6e 67 20 69 | 73 20 64 65 73 63 72 69 |lowing i|s descri|
|00000f10| 62 65 64 20 69 6e 20 49 | 6e 73 69 64 65 20 4d 61 |bed in I|nside Ma|
|00000f20| 63 69 6e 74 6f 73 68 2c | 20 41 70 70 6c 65 20 68 |cintosh,| Apple h|
|00000f30| 61 73 20 6d 61 64 65 20 | 73 6f 6d 65 20 63 68 61 |as made |some cha|
|00000f40| 6e 67 65 73 20 73 69 6e | 63 65 20 69 74 73 20 70 |nges sin|ce its p|
|00000f50| 75 62 6c 69 63 61 74 69 | 6f 6e 2e 0d 46 69 72 73 |ublicati|on..Firs|
|00000f60| 74 2c 20 74 68 65 72 65 | 20 69 73 20 74 68 65 20 |t, there| is the |
|00000f70| 73 74 72 75 63 74 75 72 | 65 20 6f 66 20 74 68 65 |structur|e of the|
|00000f80| 20 75 6e 69 74 20 74 61 | 62 6c 65 2e 20 49 74 20 | unit ta|ble. It |
|00000f90| 69 73 20 61 20 6e 6f 6e | 2d 72 65 6c 6f 63 61 74 |is a non|-relocat|
|00000fa0| 61 62 6c 65 20 62 6c 6f | 63 6b 20 69 6e 20 74 68 |able blo|ck in th|
|00000fb0| 65 20 73 79 73 74 65 6d | 20 68 65 61 70 20 74 68 |e system| heap th|
|00000fc0| 61 74 20 69 73 20 70 6f | 69 6e 74 65 64 20 74 6f |at is po|inted to|
|00000fd0| 20 62 79 20 74 68 65 20 | 6c 6f 77 2d 6d 65 6d 6f | by the |low-memo|
|00000fe0| 72 79 20 67 6c 6f 62 61 | 6c 20 55 54 61 62 6c 65 |ry globa|l UTable|
|00000ff0| 42 61 73 65 20 28 24 31 | 31 43 29 2e 20 54 68 65 |Base ($1|1C). The|
|00001000| 20 75 6e 69 74 20 74 61 | 62 6c 65 20 69 73 20 61 | unit ta|ble is a|
|00001010| 20 63 6f 6e 74 69 67 75 | 6f 75 73 20 74 61 62 6c | contigu|ous tabl|
|00001020| 65 20 6f 66 20 68 61 6e | 64 6c 65 73 20 74 6f 20 |e of han|dles to |
|00001030| 44 65 76 69 63 65 20 43 | 6f 6e 74 72 6f 6c 20 45 |Device C|ontrol E|
|00001040| 6e 74 72 79 20 28 44 43 | 45 29 20 72 65 63 6f 72 |ntry (DC|E) recor|
|00001050| 64 73 2e 20 54 68 65 20 | 6f 66 66 73 65 74 20 6f |ds. The |offset o|
|00001060| 66 20 61 20 68 61 6e 64 | 6c 65 20 77 69 74 68 69 |f a hand|le withi|
|00001070| 6e 20 74 68 65 20 75 6e | 69 74 20 74 61 62 6c 65 |n the un|it table|
|00001080| 20 28 69 74 73 20 65 6e | 74 72 79 2c 20 6f 72 20 | (its en|try, or |
|00001090| d2 73 6c 6f 74 d3 29 20 | 64 65 74 65 72 6d 69 6e |.slot.) |determin|
|000010a0| 65 73 20 74 68 65 20 75 | 6e 69 74 20 6e 75 6d 62 |es the u|nit numb|
|000010b0| 65 72 20 66 6f 72 20 74 | 68 65 20 64 72 69 76 65 |er for t|he drive|
|000010c0| 72 2c 20 61 73 20 77 65 | 6c 6c 20 61 73 20 74 68 |r, as we|ll as th|
|000010d0| 65 20 72 65 66 6e 75 6d | 20 66 6f 72 20 74 68 61 |e refnum| for tha|
|000010e0| 74 20 68 61 6e 64 6c 65 | 2c 20 73 69 6e 63 65 20 |t handle|, since |
|000010f0| 61 20 75 6e 69 74 20 6e | 75 6d 62 65 72 20 72 65 |a unit n|umber re|
|00001100| 6c 61 74 65 73 20 74 6f | 20 61 20 72 65 66 6e 75 |lates to| a refnu|
|00001110| 6d 20 69 6e 20 74 68 65 | 20 66 6f 6c 6c 6f 77 69 |m in the| followi|
|00001120| 6e 67 20 77 61 79 3a 0d | 20 20 20 20 72 65 66 6e |ng way:.| refn|
|00001130| 75 6d 20 3d 20 7e 28 20 | 75 6e 69 74 20 6e 75 6d |um = ~( |unit num|
|00001140| 62 65 72 20 29 0d 49 66 | 20 74 68 65 20 68 61 6e |ber ).If| the han|
|00001150| 64 6c 65 20 61 74 20 61 | 20 70 61 72 74 69 63 75 |dle at a| particu|
|00001160| 6c 61 72 20 73 6c 6f 74 | 20 69 73 20 4e 49 4c 2c |lar slot| is NIL,|
|00001170| 20 74 68 65 72 65 20 69 | 73 20 6e 6f 20 44 43 45 | there i|s no DCE|
|00001180| 20 61 6e 64 20 74 68 75 | 73 20 6e 6f 20 64 72 69 | and thu|s no dri|
|00001190| 76 65 72 20 69 6e 73 74 | 61 6c 6c 65 64 20 66 6f |ver inst|alled fo|
|000011a0| 72 20 74 68 61 74 20 72 | 65 66 6e 75 6d 2e 20 54 |r that r|efnum. T|
|000011b0| 68 65 72 65 20 69 73 20 | 61 6e 6f 74 68 65 72 20 |here is |another |
|000011c0| 6c 6f 77 2d 6d 65 6d 6f | 72 79 20 67 6c 6f 62 61 |low-memo|ry globa|
|000011d0| 6c 2c 20 55 6e 69 74 4e | 74 72 79 43 6e 74 20 28 |l, UnitN|tryCnt (|
|000011e0| 24 31 44 32 29 2c 20 77 | 68 69 63 68 20 69 73 20 |$1D2), w|hich is |
|000011f0| 74 68 65 20 63 6f 75 6e | 74 20 6f 66 20 65 6e 74 |the coun|t of ent|
|00001200| 72 69 65 73 20 69 6e 20 | 74 68 65 20 75 6e 69 74 |ries in |the unit|
|00001210| 20 74 61 62 6c 65 2e 20 | 54 68 69 73 20 6c 6f 77 | table. |This low|
|00001220| 2d 6d 65 6d 6f 72 79 20 | 67 6c 6f 62 61 6c 20 63 |-memory |global c|
|00001230| 61 6e 20 62 65 20 75 73 | 65 64 20 74 6f 20 6b 6e |an be us|ed to kn|
|00001240| 6f 77 20 77 68 65 6e 20 | 74 6f 20 73 74 6f 70 20 |ow when |to stop |
|00001250| 73 65 61 72 63 68 69 6e | 67 20 74 68 65 20 75 6e |searchin|g the un|
|00001260| 69 74 20 74 61 62 6c 65 | 2e 0d 4d 61 6e 79 20 6f |it table|..Many o|
|00001270| 66 20 74 68 65 20 73 6c | 6f 74 73 20 69 6e 20 74 |f the sl|ots in t|
|00001280| 68 65 20 75 6e 69 74 20 | 74 61 62 6c 65 20 61 72 |he unit |table ar|
|00001290| 65 20 63 6f 6d 6d 69 74 | 74 65 64 20 74 6f 20 63 |e commit|ted to c|
|000012a0| 65 72 74 61 69 6e 20 64 | 65 76 69 63 65 73 20 64 |ertain d|evices d|
|000012b0| 75 65 20 74 6f 20 74 68 | 65 20 66 61 63 74 20 74 |ue to th|e fact t|
|000012c0| 68 61 74 20 74 68 65 20 | 63 6f 72 72 65 73 70 6f |hat the |correspo|
|000012d0| 6e 64 69 6e 67 20 72 65 | 66 65 72 65 6e 63 65 20 |nding re|ference |
|000012e0| 6e 75 6d 62 65 72 73 20 | 61 72 65 20 63 6f 6d 6d |numbers |are comm|
|000012f0| 69 74 74 65 64 20 74 6f | 20 74 68 6f 73 65 20 64 |itted to| those d|
|00001300| 65 76 69 63 65 73 2e 20 | 46 6f 72 20 65 78 61 6d |evices. |For exam|
|00001310| 70 6c 65 2c 20 74 68 65 | 20 72 65 66 6e 75 6d 20 |ple, the| refnum |
|00001320| 2d 33 20 69 73 20 72 65 | 73 65 72 76 65 64 20 66 |-3 is re|served f|
|00001330| 6f 72 20 74 68 65 20 2e | 50 72 69 6e 74 20 64 72 |or the .|Print dr|
|00001340| 69 76 65 72 3b 20 74 68 | 65 72 65 66 6f 72 65 2c |iver; th|erefore,|
|00001350| 20 75 6e 69 74 20 6e 75 | 6d 62 65 72 20 2d 28 2d | unit nu|mber -(-|
|00001360| 33 29 2d 31 3d 32 20 69 | 73 20 72 65 73 65 72 76 |3)-1=2 i|s reserv|
|00001370| 65 64 2c 20 77 68 69 63 | 68 20 6d 65 61 6e 73 20 |ed, whic|h means |
|00001380| 74 68 61 74 20 74 68 65 | 20 73 6c 6f 74 20 61 74 |that the| slot at|
|00001390| 20 6f 66 66 73 65 74 20 | 38 20 28 34 20 62 79 74 | offset |8 (4 byt|
|000013a0| 65 73 20 70 65 72 20 68 | 61 6e 64 6c 65 20 2a 20 |es per h|andle * |
|000013b0| 32 29 20 69 6e 20 74 68 | 65 20 75 6e 69 74 20 74 |2) in th|e unit t|
|000013c0| 61 62 6c 65 20 69 73 20 | 72 65 73 65 72 76 65 64 |able is |reserved|
|000013d0| 20 66 6f 72 20 74 68 65 | 20 68 61 6e 64 6c 65 20 | for the| handle |
|000013e0| 74 6f 20 74 68 65 20 44 | 43 45 20 6f 66 20 74 68 |to the D|CE of th|
|000013f0| 65 20 2e 50 72 69 6e 74 | 20 64 72 69 76 65 72 2e |e .Print| driver.|
|00001400| 20 54 68 69 73 20 72 65 | 6c 61 74 69 6f 6e 73 68 | This re|lationsh|
|00001410| 69 70 20 69 73 20 74 72 | 75 65 20 65 76 65 6e 20 |ip is tr|ue even |
|00001420| 69 66 20 74 68 65 20 73 | 6c 6f 74 20 69 73 20 63 |if the s|lot is c|
|00001430| 75 72 72 65 6e 74 6c 79 | 20 4e 49 4c 2c 20 62 65 |urrently| NIL, be|
|00001440| 63 61 75 73 65 20 61 20 | 6c 6f 74 20 6f 66 20 74 |cause a |lot of t|
|00001450| 68 65 20 6f 70 65 72 61 | 74 69 6e 67 20 73 79 73 |he opera|ting sys|
|00001460| 74 65 6d 2c 20 54 6f 6f | 6c 62 6f 78 2c 20 61 6e |tem, Too|lbox, an|
|00001470| 64 20 61 70 70 6c 69 63 | 61 74 69 6f 6e 73 20 6d |d applic|ations m|
|00001480| 61 6b 65 20 68 65 61 76 | 79 20 61 73 73 75 6d 70 |ake heav|y assump|
|00001490| 74 69 6f 6e 73 20 61 62 | 6f 75 74 20 74 68 65 20 |tions ab|out the |
|000014a0| 72 65 66 6e 75 6d 20 6f | 66 20 61 20 70 61 72 74 |refnum o|f a part|
|000014b0| 69 63 75 6c 61 72 20 64 | 65 76 69 63 65 2e 20 54 |icular d|evice. T|
|000014c0| 68 65 72 65 20 61 72 65 | 20 6d 6f 72 65 20 64 65 |here are| more de|
|000014d0| 74 61 69 6c 65 64 20 6c | 69 73 74 73 20 69 6e 20 |tailed l|ists in |
|000014e0| 49 6e 73 69 64 65 20 4d | 61 63 69 6e 74 6f 73 68 |Inside M|acintosh|
|000014f0| 2c 20 62 75 74 20 66 6f | 6c 6c 6f 77 69 6e 67 20 |, but fo|llowing |
|00001500| 69 73 20 61 20 73 75 6d | 6d 61 72 79 20 6c 69 73 |is a sum|mary lis|
|00001510| 74 20 6f 66 20 77 68 61 | 74 20 75 6e 69 74 20 6e |t of wha|t unit n|
|00001520| 75 6d 62 65 72 73 20 61 | 72 65 20 63 6f 6d 6d 69 |umbers a|re commi|
|00001530| 74 74 65 64 20 74 6f 20 | 77 68 61 74 20 64 65 76 |tted to |what dev|
|00001540| 69 63 65 20 74 79 70 65 | 73 3a 0d 55 6e 69 74 20 |ice type|s:.Unit |
|00001550| 4e 75 6d 62 65 72 20 52 | 61 6e 67 65 09 52 65 66 |Number R|ange.Ref|
|00001560| 6e 75 6d 20 52 61 6e 67 | 65 09 55 73 61 67 65 0d |num Rang|e.Usage.|
|00001570| 30 20 74 68 72 6f 75 67 | 68 20 31 31 09 2d 31 20 |0 throug|h 11.-1 |
|00001580| 74 68 72 6f 75 67 68 20 | 2d 31 32 09 53 65 72 69 |through |-12.Seri|
|00001590| 61 6c 2c 20 44 69 73 6b | 2c 20 41 70 70 6c 65 54 |al, Disk|, AppleT|
|000015a0| 61 6c 6b 2c 20 50 72 69 | 6e 74 65 72 2c 20 65 74 |alk, Pri|nter, et|
|000015b0| 63 2e 0d 31 32 20 74 68 | 72 6f 75 67 68 20 33 31 |c..12 th|rough 31|
|000015c0| 09 2d 31 33 20 74 68 72 | 6f 75 67 68 20 2d 33 32 |.-13 thr|ough -32|
|000015d0| 09 44 65 73 6b 20 41 63 | 63 65 73 73 6f 72 69 65 |.Desk Ac|cessorie|
|000015e0| 73 0d 33 32 20 74 68 72 | 6f 75 67 68 20 33 39 09 |s.32 thr|ough 39.|
|000015f0| 2d 33 33 20 74 68 72 6f | 75 67 68 20 2d 34 30 09 |-33 thro|ugh -40.|
|00001600| 53 43 53 49 20 44 65 76 | 69 63 65 73 0d 34 30 20 |SCSI Dev|ices.40 |
|00001610| 74 68 72 6f 75 67 68 20 | 34 37 09 2d 34 31 20 74 |through |47.-41 t|
|00001620| 68 72 6f 75 67 68 20 2d | 34 38 09 41 70 70 6c 65 |hrough -|48.Apple|
|00001630| 53 68 61 72 65 20 61 6e | 64 20 6f 74 68 65 72 20 |Share an|d other |
|00001640| 72 65 73 65 72 76 65 64 | 20 66 6f 72 20 41 70 70 |reserved| for App|
|00001650| 6c 65 0d 34 38 20 74 68 | 72 6f 75 67 68 20 36 33 |le.48 th|rough 63|
|00001660| 2c 20 31 32 37 09 2d 34 | 39 20 74 68 72 6f 75 67 |, 127.-4|9 throug|
|00001670| 68 20 2d 36 34 2c 20 2d | 31 32 38 09 53 6c 6f 74 |h -64, -|128.Slot|
|00001680| 20 64 72 69 76 65 72 73 | d1 6f 70 65 6e 20 66 6f | drivers|.open fo|
|00001690| 72 20 6f 74 68 65 72 20 | 64 72 69 76 65 72 73 20 |r other |drivers |
|000016a0| 61 73 20 77 65 6c 6c 0d | 54 68 65 20 65 6e 74 72 |as well.|The entr|
|000016b0| 79 20 66 6f 72 20 75 6e | 69 74 20 6e 75 6d 62 65 |y for un|it numbe|
|000016c0| 72 73 20 34 38 20 61 6e | 64 20 61 62 6f 76 65 20 |rs 48 an|d above |
|000016d0| 72 65 71 75 69 72 65 73 | 20 73 6f 6d 65 20 65 78 |requires| some ex|
|000016e0| 70 6c 61 6e 61 74 69 6f | 6e 2e 20 46 69 72 73 74 |planatio|n. First|
|000016f0| 2c 20 6f 6e 20 74 68 65 | 20 4d 61 63 69 6e 74 6f |, on the| Macinto|
|00001700| 73 68 20 35 31 32 4b 45 | 20 61 6e 64 20 4d 61 63 |sh 512KE| and Mac|
|00001710| 69 6e 74 6f 73 68 20 50 | 6c 75 73 2c 20 74 68 65 |intosh P|lus, the|
|00001720| 20 75 6e 69 74 20 74 61 | 62 6c 65 20 64 6f 65 73 | unit ta|ble does|
|00001730| 20 6e 6f 74 20 67 6f 20 | 70 61 73 74 20 75 6e 69 | not go |past uni|
|00001740| 74 20 6e 75 6d 62 65 72 | 20 34 37 3b 20 74 68 69 |t number| 47; thi|
|00001750| 73 20 70 6f 69 6e 74 20 | 69 73 20 61 64 64 72 65 |s point |is addre|
|00001760| 73 73 65 64 20 6c 61 74 | 65 72 2e 20 20 4f 6e 20 |ssed lat|er. On |
|00001770| 74 68 65 20 4d 61 63 69 | 6e 74 6f 73 68 20 53 45 |the Maci|ntosh SE|
|00001780| 2c 20 74 68 65 20 75 6e | 69 74 20 74 61 62 6c 65 |, the un|it table|
|00001790| 20 69 73 20 6c 61 72 67 | 65 20 65 6e 6f 75 67 68 | is larg|e enough|
|000017a0| 20 74 6f 20 68 6f 6c 64 | 20 75 70 20 74 6f 20 75 | to hold| up to u|
|000017b0| 6e 69 74 20 6e 75 6d 62 | 65 72 20 36 33 2e 20 4f |nit numb|er 63. O|
|000017c0| 6e 20 74 68 65 20 4d 61 | 63 69 6e 74 6f 73 68 20 |n the Ma|cintosh |
|000017d0| 49 49 20 66 61 6d 69 6c | 79 20 6f 66 20 6d 61 63 |II famil|y of mac|
|000017e0| 68 69 6e 65 73 2c 20 74 | 68 65 20 75 6e 69 74 20 |hines, t|he unit |
|000017f0| 74 61 62 6c 65 20 69 73 | 20 6c 61 72 67 65 20 65 |table is| large e|
|00001800| 6e 6f 75 67 68 20 74 6f | 20 68 6f 6c 64 20 75 70 |nough to| hold up|
|00001810| 20 74 6f 20 75 6e 69 74 | 20 6e 75 6d 62 65 72 20 | to unit| number |
|00001820| 31 32 37 3b 20 55 6e 69 | 74 4e 74 72 79 43 6e 74 |127; Uni|tNtryCnt|
|00001830| 20 69 73 20 70 72 6f 62 | 61 62 6c 79 20 6c 6f 77 | is prob|ably low|
|00001840| 65 72 2c 20 74 68 6f 75 | 67 68 20 6e 6f 74 20 6c |er, thou|gh not l|
|00001850| 6f 77 65 72 20 74 68 61 | 6e 20 36 34 2e 0d 41 66 |ower tha|n 64..Af|
|00001860| 74 65 72 20 64 6f 63 75 | 6d 65 6e 74 69 6e 67 20 |ter docu|menting |
|00001870| 74 68 65 20 64 65 76 69 | 63 65 20 63 6f 6e 74 72 |the devi|ce contr|
|00001880| 6f 6c 20 65 6e 74 72 79 | 20 62 6c 6f 63 6b 73 20 |ol entry| blocks |
|00001890| 69 6e 20 49 6e 73 69 64 | 65 20 4d 61 63 69 6e 74 |in Insid|e Macint|
|000018a0| 6f 73 68 2c 20 56 6f 6c | 75 6d 65 20 49 49 2c 20 |osh, Vol|ume II, |
|000018b0| 41 70 70 6c 65 20 68 61 | 73 20 65 78 70 61 6e 64 |Apple ha|s expand|
|000018c0| 65 64 20 74 68 65 6d 20 | 74 6f 20 64 65 61 6c 20 |ed them |to deal |
|000018d0| 77 69 74 68 20 6e 65 77 | 20 66 65 61 74 75 72 65 |with new| feature|
|000018e0| 73 20 6c 69 6b 65 20 74 | 68 65 20 53 6c 6f 74 20 |s like t|he Slot |
|000018f0| 4d 61 6e 61 67 65 72 2e | 20 54 68 65 20 6e 65 77 |Manager.| The new|
|00001900| 20 44 43 45 20 6c 6f 6f | 6b 73 20 74 68 65 20 73 | DCE loo|ks the s|
|00001910| 61 6d 65 20 61 73 20 74 | 68 65 20 6f 6c 64 20 44 |ame as t|he old D|
|00001920| 43 45 2c 20 62 75 74 20 | 63 6f 6e 74 61 69 6e 73 |CE, but |contains|
|00001930| 20 61 20 66 65 77 20 61 | 64 64 69 74 69 6f 6e 61 | a few a|dditiona|
|00001940| 6c 20 66 69 65 6c 64 73 | 3a 0d 20 20 20 20 54 59 |l fields|:. TY|
|00001950| 50 45 20 41 75 78 44 43 | 45 20 3d 20 50 41 43 4b |PE AuxDC|E = PACK|
|00001960| 45 44 20 52 45 43 4f 52 | 44 0d 20 20 20 20 20 20 |ED RECOR|D. |
|00001970| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 64 | | d|
|00001980| 43 74 6c 44 72 69 76 65 | 72 3a 20 20 20 20 50 74 |CtlDrive|r: Pt|
|00001990| 72 3b 0d 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |r;. | |
|000019a0| 20 20 20 20 20 20 20 20 | 64 43 74 6c 46 6c 61 67 | |dCtlFlag|
|000019b0| 73 3a 20 20 20 20 20 49 | 4e 54 45 47 45 52 3b 0d |s: I|NTEGER;.|
|000019c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000019d0| 20 20 20 20 20 64 43 74 | 6c 51 48 64 72 3a 20 20 | dCt|lQHdr: |
|000019e0| 20 20 20 20 51 48 64 72 | 3b 0d 20 20 20 20 20 20 | QHdr|;. |
|000019f0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 64 | | d|
|00001a00| 43 74 6c 50 6f 73 69 74 | 69 6f 6e 3a 20 20 4c 4f |CtlPosit|ion: LO|
|00001a10| 4e 47 49 4e 54 3b 0d 20 | 20 20 20 20 20 20 20 20 |NGINT;. | |
|00001a20| 20 20 20 20 20 20 20 20 | 20 20 20 20 64 43 74 6c | | dCtl|
|00001a30| 53 74 6f 72 61 67 65 3a | 20 20 20 48 61 6e 64 6c |Storage:| Handl|
|00001a40| 65 3b 0d 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |e;. | |
|00001a50| 20 20 20 20 20 20 20 20 | 64 43 74 6c 52 65 66 6e | |dCtlRefn|
|00001a60| 75 6d 3a 20 20 20 20 49 | 4e 54 45 47 45 52 3b 0d |um: I|NTEGER;.|
|00001a70| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001a80| 20 20 20 20 20 64 43 74 | 6c 43 75 72 54 69 63 6b | dCt|lCurTick|
|00001a90| 73 3a 20 20 4c 4f 4e 47 | 49 4e 54 3b 0d 20 20 20 |s: LONG|INT;. |
|00001aa0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001ab0| 20 20 64 43 74 6c 57 69 | 6e 64 6f 77 3a 20 20 20 | dCtlWi|ndow: |
|00001ac0| 20 50 74 72 3b 0d 20 20 | 20 20 20 20 20 20 20 20 | Ptr;. | |
|00001ad0| 20 20 20 20 20 20 20 20 | 20 20 20 64 43 74 6c 44 | | dCtlD|
|00001ae0| 65 6c 61 79 3a 20 20 20 | 20 20 49 4e 54 45 47 45 |elay: | INTEGE|
|00001af0| 52 3b 0d 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |R;. | |
|00001b00| 20 20 20 20 20 20 20 20 | 64 43 74 6c 45 4d 61 73 | |dCtlEMas|
|00001b10| 6b 3a 20 20 20 20 20 49 | 4e 54 45 47 45 52 3b 0d |k: I|NTEGER;.|
|00001b20| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001b30| 20 20 20 20 20 64 43 74 | 6c 4d 65 6e 75 3a 20 20 | dCt|lMenu: |
|00001b40| 20 20 20 20 49 4e 54 45 | 47 45 52 3b 0d 54 68 65 | INTE|GER;.The|
|00001b50| 20 66 6f 6c 6c 6f 77 69 | 6e 67 20 66 69 65 6c 64 | followi|ng field|
|00001b60| 73 20 61 72 65 20 74 68 | 65 20 61 64 64 69 74 69 |s are th|e additi|
|00001b70| 6f 6e 73 20 66 6f 72 20 | 74 68 65 20 6e 65 77 20 |ons for |the new |
|00001b80| 44 43 45 20 72 65 63 6f | 72 64 3a 0d 20 20 20 20 |DCE reco|rd:. |
|00001b90| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001ba0| 20 64 43 74 6c 53 6c 6f | 74 3a 20 20 20 20 20 20 | dCtlSlo|t: |
|00001bb0| 42 79 74 65 3b 0d 20 20 | 20 20 20 20 20 20 20 20 |Byte;. | |
|00001bc0| 20 20 20 20 20 20 20 20 | 20 20 20 64 43 74 6c 53 | | dCtlS|
|00001bd0| 6c 6f 74 49 64 3a 20 20 | 20 20 42 79 74 65 3b 0d |lotId: | Byte;.|
|00001be0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001bf0| 20 20 20 20 20 64 43 74 | 6c 44 65 76 42 61 73 65 | dCt|lDevBase|
|00001c00| 3a 20 20 20 4c 4f 4e 47 | 49 4e 54 3b 0d 20 20 20 |: LONG|INT;. |
|00001c10| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001c20| 20 20 72 65 73 65 72 76 | 65 64 3a 20 20 20 20 20 | reserv|ed: |
|00001c30| 20 4c 4f 4e 47 49 4e 54 | 3b 0d 20 20 20 20 20 20 | LONGINT|;. |
|00001c40| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 64 | | d|
|00001c50| 43 74 6c 45 78 74 44 65 | 76 3a 20 20 20 20 42 79 |CtlExtDe|v: By|
|00001c60| 74 65 3b 0d 20 20 20 20 | 20 20 20 20 20 20 20 20 |te;. | |
|00001c70| 20 20 20 20 20 20 20 20 | 20 66 69 6c 6c 42 79 74 | | fillByt|
|00001c80| 65 3a 20 20 20 20 20 20 | 42 79 74 65 3b 0d 20 20 |e: |Byte;. |
|00001c90| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001ca0| 45 4e 44 3b 0d 54 68 65 | 20 63 6f 72 65 20 73 74 |END;.The| core st|
|00001cb0| 72 75 63 74 75 72 65 20 | 6f 66 20 70 61 72 61 6d |ructure |of param|
|00001cc0| 65 74 65 72 20 62 6c 6f | 63 6b 73 20 68 61 73 20 |eter blo|cks has |
|00001cd0| 72 65 6d 61 69 6e 65 64 | 20 74 68 65 20 73 61 6d |remained| the sam|
|00001ce0| 65 20 61 73 20 64 65 73 | 63 72 69 62 65 64 20 69 |e as des|cribed i|
|00001cf0| 6e 20 49 6e 73 69 64 65 | 20 4d 61 63 69 6e 74 6f |n Inside| Macinto|
|00001d00| 73 68 2e 20 54 68 65 79 | 20 62 65 67 69 6e 20 77 |sh. They| begin w|
|00001d10| 69 74 68 20 74 68 65 20 | 73 74 61 6e 64 61 72 64 |ith the |standard|
|00001d20| 20 49 2f 4f 20 71 75 65 | 75 65 20 66 69 65 6c 64 | I/O que|ue field|
|00001d30| 73 3a 0d 20 20 20 20 54 | 59 50 45 20 50 61 72 61 |s:. T|YPE Para|
|00001d40| 6d 42 6c 6f 63 6b 52 65 | 63 20 3d 20 52 45 43 4f |mBlockRe|c = RECO|
|00001d50| 52 44 0d 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |RD. | |
|00001d60| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 71 | | q|
|00001d70| 4c 69 6e 6b 3a 20 20 20 | 20 20 20 20 20 20 51 45 |Link: | QE|
|00001d80| 6c 65 6d 50 74 72 3b 0d | 20 20 20 20 20 20 20 20 |lemPtr;.| |
|00001d90| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001da0| 20 20 20 20 71 54 79 70 | 65 3a 20 20 20 20 20 20 | qTyp|e: |
|00001db0| 20 20 20 49 4e 54 45 47 | 45 52 3b 0d 20 20 20 20 | INTEG|ER;. |
|00001dc0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001dd0| 20 20 20 20 20 20 20 20 | 69 6f 54 72 61 70 3a 20 | |ioTrap: |
|00001de0| 20 20 20 20 20 20 20 49 | 4e 54 45 47 45 52 3b 0d | I|NTEGER;.|
|00001df0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001e00| 20 20 20 20 20 20 20 20 | 20 20 20 20 69 6f 43 6d | | ioCm|
|00001e10| 64 41 64 64 72 3a 20 20 | 20 20 20 50 74 72 3b 0d |dAddr: | Ptr;.|
|00001e20| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001e30| 20 20 20 20 20 20 20 20 | 20 20 20 20 69 6f 43 6f | | ioCo|
|00001e40| 6d 70 6c 65 74 69 6f 6e | 3a 20 20 50 72 6f 63 50 |mpletion|: ProcP|
|00001e50| 74 72 3b 0d 20 20 20 20 | 20 20 20 20 20 20 20 20 |tr;. | |
|00001e60| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001e70| 69 6f 52 65 73 75 6c 74 | 3a 20 20 20 20 20 20 4f |ioResult|: O|
|00001e80| 53 45 72 72 3b 0d 20 20 | 20 20 20 20 20 20 20 20 |SErr;. | |
|00001e90| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001ea0| 20 20 69 6f 4e 61 6d 65 | 50 74 72 3a 20 20 20 20 | ioName|Ptr: |
|00001eb0| 20 53 74 72 69 6e 67 50 | 74 72 3b 0d 20 20 20 20 | StringP|tr;. |
|00001ec0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001ed0| 20 20 20 20 20 20 20 20 | 69 6f 56 52 65 66 4e 75 | |ioVRefNu|
|00001ee0| 6d 3a 20 20 20 20 20 49 | 4e 54 45 47 45 52 3b 0d |m: I|NTEGER;.|
|00001ef0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001f00| 20 20 20 20 20 20 20 20 | 20 20 20 20 69 6f 52 65 | | ioRe|
|00001f10| 66 4e 75 6d 3a 20 20 20 | 20 20 20 49 4e 54 45 47 |fNum: | INTEG|
|00001f20| 45 52 3b 0d 20 20 20 20 | 20 20 20 20 20 20 20 20 |ER;. | |
|00001f30| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001f40| 2e 2e 2e 0d 20 20 20 20 | 20 20 20 20 20 20 20 20 |.... | |
|00001f50| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 45 4e 44 | | END|
|00001f60| 3b 0d 54 68 65 20 72 65 | 73 74 20 6f 66 20 74 68 |;.The re|st of th|
|00001f70| 65 20 70 61 72 61 6d 65 | 74 65 72 20 62 6c 6f 63 |e parame|ter bloc|
|00001f80| 6b 20 69 73 20 68 65 61 | 76 69 6c 79 20 64 65 70 |k is hea|vily dep|
|00001f90| 65 6e 64 65 6e 74 20 6f | 6e 20 74 68 65 20 64 65 |endent o|n the de|
|00001fa0| 76 69 63 65 20 64 72 69 | 76 65 72 20 74 68 61 74 |vice dri|ver that|
|00001fb0| 20 75 73 65 73 20 69 74 | 20 61 6e 64 20 77 68 61 | uses it| and wha|
|00001fc0| 74 20 6b 69 6e 64 20 6f | 66 20 64 72 69 76 65 72 |t kind o|f driver|
|00001fd0| 20 63 61 6c 6c 20 69 73 | 20 62 65 69 6e 67 20 6d | call is| being m|
|00001fe0| 61 64 65 2e 0d 46 69 67 | 75 72 65 20 31 d0 42 61 |ade..Fig|ure 1.Ba|
|00001ff0| 73 69 63 20 44 65 76 69 | 63 65 20 4d 61 6e 61 67 |sic Devi|ce Manag|
|00002000| 65 72 20 44 61 74 61 20 | 53 74 72 75 63 74 75 72 |er Data |Structur|
|00002010| 65 73 0d 54 68 65 20 55 | 6e 69 74 20 54 61 62 6c |es.The U|nit Tabl|
|00002020| 65 2c 20 74 68 65 20 44 | 43 45 2c 20 61 6e 64 20 |e, the D|CE, and |
|00002030| 74 68 65 20 50 61 72 61 | 6d 65 74 65 72 20 42 6c |the Para|meter Bl|
|00002040| 6f 63 6b 20 61 6c 6c 20 | 77 6f 72 6b 20 74 6f 67 |ock all |work tog|
|00002050| 65 74 68 65 72 20 74 6f | 20 70 72 6f 76 69 64 65 |ether to| provide|
|00002060| 20 61 6c 6c 20 74 68 65 | 20 69 6e 66 6f 72 6d 61 | all the| informa|
|00002070| 74 69 6f 6e 20 6e 65 63 | 65 73 73 61 72 79 20 66 |tion nec|essary f|
|00002080| 6f 72 20 74 68 65 20 61 | 70 70 6c 69 63 61 74 69 |or the a|pplicati|
|00002090| 6f 6e 2c 20 44 65 76 69 | 63 65 20 4d 61 6e 61 67 |on, Devi|ce Manag|
|000020a0| 65 72 2c 20 61 6e 64 20 | 64 65 76 69 63 65 20 64 |er, and |device d|
|000020b0| 72 69 76 65 72 20 74 6f | 20 63 6f 6d 6d 75 6e 69 |river to| communi|
|000020c0| 63 61 74 65 20 77 69 74 | 68 20 6f 6e 65 20 61 6e |cate wit|h one an|
|000020d0| 6f 74 68 65 72 2e 20 46 | 6f 72 20 65 78 61 6d 70 |other. F|or examp|
|000020e0| 6c 65 2c 20 74 68 65 20 | 73 74 72 75 63 74 75 72 |le, the |structur|
|000020f0| 65 20 6f 66 20 61 20 52 | 41 4d 2d 62 61 73 65 64 |e of a R|AM-based|
|00002100| 20 64 72 69 76 65 72 20 | 74 68 61 74 20 68 61 73 | driver |that has|
|00002110| 20 62 65 65 6e 20 6f 70 | 65 6e 65 64 20 61 6e 64 | been op|ened and|
|00002120| 20 63 61 6c 6c 65 64 20 | 61 73 79 6e 63 68 72 6f | called |asynchro|
|00002130| 6e 6f 75 73 6c 79 20 61 | 20 66 65 77 20 74 69 6d |nously a| few tim|
|00002140| 65 73 20 6d 69 67 68 74 | 20 6c 6f 6f 6b 20 6c 69 |es might| look li|
|00002150| 6b 65 20 74 68 61 74 20 | 73 68 6f 77 6e 20 69 6e |ke that |shown in|
|00002160| 20 46 69 67 75 72 65 20 | 31 2e 0d 52 6f 75 74 69 | Figure |1..Routi|
|00002170| 6e 65 20 4d 61 69 6e 74 | 65 6e 61 6e 63 65 0d 41 |ne Maint|enance.A|
|00002180| 20 64 65 76 69 63 65 20 | 64 72 69 76 65 72 20 69 | device |driver i|
|00002190| 73 20 61 20 62 6c 6f 63 | 6b 20 6f 66 20 64 61 74 |s a bloc|k of dat|
|000021a0| 61 20 63 6f 6d 70 6f 73 | 65 64 20 6f 66 20 61 20 |a compos|ed of a |
|000021b0| 68 65 61 64 65 72 20 66 | 6f 6c 6c 6f 77 65 64 20 |header f|ollowed |
|000021c0| 62 79 20 65 78 65 63 75 | 74 61 62 6c 65 20 63 6f |by execu|table co|
|000021d0| 64 65 2e 20 54 68 65 20 | 68 65 61 64 65 72 20 63 |de. The |header c|
|000021e0| 6f 6e 74 61 69 6e 73 20 | 66 6c 61 67 73 2c 20 61 |ontains |flags, a|
|000021f0| 20 64 65 6c 61 79 20 61 | 6d 6f 75 6e 74 2c 20 61 | delay a|mount, a|
|00002200| 6e 20 65 76 65 6e 74 20 | 6d 61 73 6b 2c 20 61 20 |n event |mask, a |
|00002210| 6d 65 6e 75 20 49 44 2c | 20 61 6e 20 6f 70 74 69 |menu ID,| an opti|
|00002220| 6f 6e 61 6c 20 6e 61 6d | 65 20 6f 66 20 74 68 65 |onal nam|e of the|
|00002230| 20 64 72 69 76 65 72 2c | 20 61 6e 64 20 6f 66 66 | driver,| and off|
|00002240| 73 65 74 73 20 74 6f 20 | 74 68 65 20 72 6f 75 74 |sets to |the rout|
|00002250| 69 6e 65 73 20 74 68 61 | 74 20 61 72 65 20 69 6e |ines tha|t are in|
|00002260| 20 74 68 65 20 65 78 65 | 63 75 74 61 62 6c 65 20 | the exe|cutable |
|00002270| 63 6f 64 65 2e 20 49 6e | 73 69 64 65 20 4d 61 63 |code. In|side Mac|
|00002280| 69 6e 74 6f 73 68 20 64 | 65 73 63 72 69 62 65 73 |intosh d|escribes|
|00002290| 20 64 65 76 69 63 65 20 | 64 72 69 76 65 72 73 20 | device |drivers |
|000022a0| 61 73 20 62 65 69 6e 67 | 20 27 44 52 56 52 27 20 |as being| 'DRVR' |
|000022b0| 72 65 73 6f 75 72 63 65 | 73 2e 20 41 6c 74 68 6f |resource|s. Altho|
|000022c0| 75 67 68 20 74 68 69 73 | 20 69 73 20 74 79 70 69 |ugh this| is typi|
|000022d0| 63 61 6c 6c 79 20 74 68 | 65 20 63 61 73 65 2c 20 |cally th|e case, |
|000022e0| 69 74 20 73 68 6f 75 6c | 64 20 62 65 20 6e 6f 74 |it shoul|d be not|
|000022f0| 65 64 20 74 68 61 74 20 | 74 68 69 73 20 69 73 20 |ed that |this is |
|00002300| 6e 6f 74 20 6e 65 63 65 | 73 73 61 72 69 6c 79 20 |not nece|ssarily |
|00002310| 61 20 72 65 71 75 69 72 | 65 6d 65 6e 74 2c 20 61 |a requir|ement, a|
|00002320| 73 20 6c 6f 6e 67 20 61 | 73 20 63 65 72 74 61 69 |s long a|s certai|
|00002330| 6e 20 72 75 6c 65 73 20 | 61 72 65 20 66 6f 6c 6c |n rules |are foll|
|00002340| 6f 77 65 64 2e 20 44 65 | 74 61 69 6c 73 20 6f 66 |owed. De|tails of|
|00002350| 20 74 68 65 73 65 20 72 | 75 6c 65 73 20 61 72 65 | these r|ules are|
|00002360| 20 64 69 73 63 75 73 73 | 65 64 20 6c 61 74 65 72 | discuss|ed later|
|00002370| 20 69 6e 20 74 68 69 73 | 20 4e 6f 74 65 2e 0d 41 | in this| Note..A|
|00002380| 20 64 65 76 69 63 65 20 | 64 72 69 76 65 72 20 63 | device |driver c|
|00002390| 61 6e 20 69 6d 70 6c 65 | 6d 65 6e 74 20 66 69 76 |an imple|ment fiv|
|000023a0| 65 20 72 6f 75 74 69 6e | 65 73 2e 20 54 68 65 20 |e routin|es. The |
|000023b0| 44 65 76 69 63 65 20 4d | 61 6e 61 67 65 72 20 63 |Device M|anager c|
|000023c0| 61 6c 6c 73 20 74 68 65 | 73 65 20 72 6f 75 74 69 |alls the|se routi|
|000023d0| 6e 65 73 20 77 68 65 6e | 20 63 65 72 74 61 69 6e |nes when| certain|
|000023e0| 20 6f 70 65 72 61 74 69 | 6e 67 20 73 79 73 74 65 | operati|ng syste|
|000023f0| 6d 20 74 72 61 70 73 20 | 61 72 65 20 65 78 65 63 |m traps |are exec|
|00002400| 75 74 65 64 2e 20 54 68 | 65 20 74 72 61 70 73 20 |uted. Th|e traps |
|00002410| 61 72 65 20 63 61 6c 6c | 65 64 20 77 69 74 68 20 |are call|ed with |
|00002420| 72 65 67 69 73 74 65 72 | 20 41 30 20 70 6f 69 6e |register| A0 poin|
|00002430| 74 69 6e 67 20 74 6f 20 | 74 68 65 20 70 61 72 61 |ting to |the para|
|00002440| 6d 65 74 65 72 20 62 6c | 6f 63 6b 2e 20 53 6f 6d |meter bl|ock. Som|
|00002450| 65 20 6f 66 20 74 68 65 | 73 65 20 74 72 61 70 73 |e of the|se traps|
|00002460| 20 63 61 6e 20 62 65 20 | 63 61 6c 6c 65 64 20 69 | can be |called i|
|00002470| 6e 20 6f 6e 65 20 6f 66 | 20 74 77 6f 20 64 69 66 |n one of| two dif|
|00002480| 66 65 72 65 6e 74 20 6d | 6f 64 65 73 3a 20 20 69 |ferent m|odes: i|
|00002490| 6d 6d 65 64 69 61 74 65 | 20 61 6e 64 20 61 73 79 |mmediate| and asy|
|000024a0| 6e 63 68 72 6f 6e 6f 75 | 73 2e 20 49 66 20 62 69 |nchronou|s. If bi|
|000024b0| 74 20 39 20 6f 66 20 74 | 68 65 20 74 72 61 70 20 |t 9 of t|he trap |
|000024c0| 77 6f 72 64 20 69 73 20 | 73 65 74 2c 20 74 68 65 |word is |set, the|
|000024d0| 20 63 61 6c 6c 20 69 73 | 20 69 6d 6d 65 64 69 61 | call is| immedia|
|000024e0| 74 65 2c 20 77 68 69 6c | 65 20 69 66 20 62 69 74 |te, whil|e if bit|
|000024f0| 20 31 30 20 69 73 20 73 | 65 74 2c 20 74 68 65 20 | 10 is s|et, the |
|00002500| 63 61 6c 6c 20 69 73 20 | 61 73 79 6e 63 68 72 6f |call is |asynchro|
|00002510| 6e 6f 75 73 2e 20 54 68 | 65 20 64 65 76 69 63 65 |nous. Th|e device|
|00002520| 20 64 72 69 76 65 72 20 | 73 68 6f 75 6c 64 20 62 | driver |should b|
|00002530| 65 20 61 62 6c 65 20 74 | 6f 20 72 65 73 70 6f 6e |e able t|o respon|
|00002540| 64 20 74 6f 20 65 76 65 | 72 79 20 63 61 6c 6c 20 |d to eve|ry call |
|00002550| 62 79 20 74 68 65 20 44 | 65 76 69 63 65 20 4d 61 |by the D|evice Ma|
|00002560| 6e 61 67 65 72 20 69 6e | 20 61 74 20 6c 65 61 73 |nager in| at leas|
|00002570| 74 20 73 6f 6d 65 20 66 | 61 73 68 69 6f 6e 2c 20 |t some f|ashion, |
|00002580| 65 76 65 6e 20 69 66 20 | 6a 75 73 74 20 74 6f 20 |even if |just to |
|00002590| 72 65 74 75 72 6e 2e 20 | 54 68 65 20 64 65 76 69 |return. |The devi|
|000025a0| 63 65 20 64 72 69 76 65 | 72 20 72 6f 75 74 69 6e |ce drive|r routin|
|000025b0| 65 73 2c 20 74 68 65 20 | 74 72 61 70 73 20 74 68 |es, the |traps th|
|000025c0| 61 74 20 63 61 75 73 65 | 20 74 68 65 20 44 65 76 |at cause| the Dev|
|000025d0| 69 63 65 20 4d 61 6e 61 | 67 65 72 20 74 6f 20 63 |ice Mana|ger to c|
|000025e0| 61 6c 6c 20 74 68 65 20 | 72 6f 75 74 69 6e 65 73 |all the |routines|
|000025f0| 2c 20 61 6e 64 20 74 68 | 65 20 76 61 72 69 6f 75 |, and th|e variou|
|00002600| 73 20 6d 6f 64 65 73 20 | 69 6e 20 77 68 69 63 68 |s modes |in which|
|00002610| 20 74 68 65 20 63 61 6c | 6c 73 20 63 61 6e 20 62 | the cal|ls can b|
|00002620| 65 20 6d 61 64 65 20 61 | 72 65 20 61 73 20 66 6f |e made a|re as fo|
|00002630| 6c 6c 6f 77 73 3a 0d 09 | 52 6f 75 74 69 6e 65 09 |llows:..|Routine.|
|00002640| 54 72 61 70 09 4d 6f 64 | 65 73 0d 09 4f 70 65 6e |Trap.Mod|es..Open|
|00002650| 09 5f 4f 70 65 6e 09 49 | 6d 6d 65 64 69 61 74 65 |._Open.I|mmediate|
|00002660| 0d 09 50 72 69 6d 65 09 | 5f 52 65 61 64 2c 20 5f |..Prime.|_Read, _|
|00002670| 57 72 69 74 65 09 49 6d | 6d 65 64 69 61 74 65 2c |Write.Im|mediate,|
|00002680| 20 41 73 79 6e 63 68 72 | 6f 6e 6f 75 73 0d 09 43 | Asynchr|onous..C|
|00002690| 6f 6e 74 72 6f 6c 09 5f | 43 6f 6e 74 72 6f 6c 09 |ontrol._|Control.|
|000026a0| 49 6d 6d 65 64 69 61 74 | 65 2c 20 41 73 79 6e 63 |Immediat|e, Async|
|000026b0| 68 72 6f 6e 6f 75 73 0d | 09 43 6f 6e 74 72 6f 6c |hronous.|.Control|
|000026c0| 09 5f 4b 69 6c 6c 49 4f | 09 49 6d 6d 65 64 69 61 |._KillIO|.Immedia|
|000026d0| 74 65 0d 09 53 74 61 74 | 75 73 09 5f 53 74 61 74 |te..Stat|us._Stat|
|000026e0| 75 73 09 49 6d 6d 65 64 | 69 61 74 65 2c 20 41 73 |us.Immed|iate, As|
|000026f0| 79 6e 63 68 72 6f 6e 6f | 75 73 0d 09 43 6c 6f 73 |ynchrono|us..Clos|
|00002700| 65 09 5f 43 6c 6f 73 65 | 09 49 6d 6d 65 64 69 61 |e._Close|.Immedia|
|00002710| 74 65 0d 5f 4f 70 65 6e | 2c 20 5f 43 6c 6f 73 65 |te._Open|, _Close|
|00002720| 2c 20 61 6e 64 20 5f 4b | 69 6c 6c 49 4f 20 61 72 |, and _K|illIO ar|
|00002730| 65 20 61 6c 77 61 79 73 | 20 69 6d 6d 65 64 69 61 |e always| immedia|
|00002740| 74 65 20 62 65 63 61 75 | 73 65 20 6f 66 20 74 68 |te becau|se of th|
|00002750| 65 20 77 61 79 20 74 68 | 65 79 20 61 72 65 20 68 |e way th|ey are h|
|00002760| 61 6e 64 6c 65 64 20 62 | 79 20 74 68 65 20 44 65 |andled b|y the De|
|00002770| 76 69 63 65 20 4d 61 6e | 61 67 65 72 2e 20 20 44 |vice Man|ager. D|
|00002780| 6f 20 6e 6f 74 20 6d 61 | 6b 65 20 61 73 79 6e 63 |o not ma|ke async|
|00002790| 68 72 6f 6e 6f 75 73 20 | 5f 4f 70 65 6e 2c 20 5f |hronous |_Open, _|
|000027a0| 43 6c 6f 73 65 2c 20 6f | 72 20 5f 4b 69 6c 6c 49 |Close, o|r _KillI|
|000027b0| 4f 20 63 61 6c 6c 73 2c | 20 61 6e 64 20 64 6f 20 |O calls,| and do |
|000027c0| 6e 6f 74 20 73 70 65 63 | 69 66 79 20 74 68 65 20 |not spec|ify the |
|000027d0| 49 4d 4d 45 44 20 62 69 | 74 20 66 6f 72 20 74 68 |IMMED bi|t for th|
|000027e0| 65 6d 20 65 78 70 6c 69 | 63 69 74 6c 79 2e 20 20 |em expli|citly. |
|000027f0| 49 74 20 69 73 20 65 78 | 74 72 65 6d 65 6c 79 20 |It is ex|tremely |
|00002800| 72 61 72 65 20 74 68 61 | 74 20 61 20 64 72 69 76 |rare tha|t a driv|
|00002810| 65 72 20 77 69 6c 6c 20 | 73 75 70 70 6f 72 74 20 |er will |support |
|00002820| 69 6d 6d 65 64 69 61 74 | 65 20 5f 52 65 61 64 20 |immediat|e _Read |
|00002830| 61 6e 64 20 5f 57 72 69 | 74 65 20 63 61 6c 6c 73 |and _Wri|te calls|
|00002840| 20 70 72 6f 70 65 72 6c | 79 2e 20 20 54 68 65 73 | properl|y. Thes|
|00002850| 65 20 63 61 6c 6c 73 20 | 73 68 6f 75 6c 64 20 62 |e calls |should b|
|00002860| 65 20 75 73 65 64 20 6f | 6e 6c 79 20 77 68 65 6e |e used o|nly when|
|00002870| 20 73 70 65 63 69 66 69 | 63 61 6c 6c 79 20 61 6c | specifi|cally al|
|00002880| 6c 6f 77 65 64 20 61 63 | 63 6f 72 64 69 6e 67 20 |lowed ac|cording |
|00002890| 74 6f 20 74 68 65 20 64 | 6f 63 75 6d 65 6e 74 61 |to the d|ocumenta|
|000028a0| 74 69 6f 6e 20 66 6f 72 | 20 61 20 64 72 69 76 65 |tion for| a drive|
|000028b0| 72 2e 0d 46 72 6f 6d 20 | 74 68 65 20 64 72 69 76 |r..From |the driv|
|000028c0| 65 72 27 73 20 70 6f 69 | 6e 74 20 6f 66 20 76 69 |er's poi|nt of vi|
|000028d0| 65 77 2c 20 4b 69 6c 6c | 49 4f 20 69 73 20 68 61 |ew, Kill|IO is ha|
|000028e0| 6e 64 6c 65 64 20 61 73 | 20 61 20 5f 43 6f 6e 74 |ndled as| a _Cont|
|000028f0| 72 6f 6c 20 63 61 6c 6c | 20 77 69 74 68 20 61 20 |rol call| with a |
|00002900| 63 73 43 6f 64 65 20 3d | 20 31 2e 20 48 6f 77 65 |csCode =| 1. Howe|
|00002910| 76 65 72 2c 20 74 68 69 | 73 20 69 73 20 61 20 66 |ver, thi|s is a f|
|00002920| 61 8d 61 64 65 20 70 72 | 6f 64 75 63 65 64 20 61 |a.ade pr|oduced a|
|00002930| 72 74 69 66 69 63 69 61 | 6c 6c 79 20 62 79 20 74 |rtificia|lly by t|
|00002940| 68 65 20 44 65 76 69 63 | 65 20 4d 61 6e 61 67 65 |he Devic|e Manage|
|00002950| 72 2e 20 43 61 6c 6c 69 | 6e 67 20 61 20 64 72 69 |r. Calli|ng a dri|
|00002960| 76 65 72 20 77 69 74 68 | 20 5f 43 6f 6e 74 72 6f |ver with| _Contro|
|00002970| 6c 20 61 6e 64 20 63 73 | 43 6f 64 65 20 3d 20 31 |l and cs|Code = 1|
|00002980| 20 69 73 20 6e 6f 74 20 | 74 68 65 20 73 61 6d 65 | is not |the same|
|00002990| 20 74 68 69 6e 67 20 61 | 73 20 61 20 4b 69 6c 6c | thing a|s a Kill|
|000029a0| 49 4f 20 61 6e 64 20 6e | 6f 6e 65 20 6f 66 20 74 |IO and n|one of t|
|000029b0| 68 65 20 6e 6f 72 6d 61 | 6c 20 64 65 71 75 65 75 |he norma|l dequeu|
|000029c0| 65 69 6e 67 20 61 63 74 | 69 6f 6e 20 77 69 6c 6c |eing act|ion will|
|000029d0| 20 74 61 6b 65 20 70 6c | 61 63 65 2e 0d 45 73 70 | take pl|ace..Esp|
|000029e0| 65 63 69 61 6c 6c 79 20 | 69 6d 70 6f 72 74 61 6e |ecially |importan|
|000029f0| 74 3a 0d 44 65 76 65 6c | 6f 70 65 72 73 20 73 68 |t:.Devel|opers sh|
|00002a00| 6f 75 6c 64 20 6e 65 76 | 65 72 20 6d 61 6b 65 20 |ould nev|er make |
|00002a10| 61 20 44 65 76 69 63 65 | 20 4d 61 6e 61 67 65 72 |a Device| Manager|
|00002a20| 20 63 61 6c 6c 20 61 74 | 20 69 6e 74 65 72 72 75 | call at| interru|
|00002a30| 70 74 20 74 69 6d 65 2c | 20 69 6e 63 6c 75 64 69 |pt time,| includi|
|00002a40| 6e 67 20 56 42 4c 73 2c | 20 54 69 6d 65 20 4d 61 |ng VBLs,| Time Ma|
|00002a50| 6e 61 67 65 72 20 74 61 | 73 6b 73 2c 20 64 65 66 |nager ta|sks, def|
|00002a60| 65 72 72 65 64 20 74 61 | 73 6b 73 2c 20 65 74 63 |erred ta|sks, etc|
|00002a70| 2e 20 75 6e 6c 65 73 73 | 20 74 68 65 20 63 61 6c |. unless| the cal|
|00002a80| 6c 20 69 73 20 61 73 79 | 6e 63 68 72 6f 6e 6f 75 |l is asy|nchronou|
|00002a90| 73 20 61 6e 64 20 74 68 | 65 20 75 6e 64 65 72 6c |s and th|e underl|
|00002aa0| 79 69 6e 67 20 64 72 69 | 76 65 72 20 69 73 20 63 |ying dri|ver is c|
|00002ab0| 61 70 61 62 6c 65 20 6f | 66 20 72 65 74 75 72 6e |apable o|f return|
|00002ac0| 69 6e 67 20 74 6f 20 74 | 68 65 20 63 61 6c 6c 65 |ing to t|he calle|
|00002ad0| 72 20 62 65 66 6f 72 65 | 20 74 68 65 20 49 2f 4f |r before| the I/O|
|00002ae0| 20 63 6f 6d 70 6c 65 74 | 65 73 2e 20 44 65 76 69 | complet|es. Devi|
|00002af0| 61 74 69 6f 6e 73 20 66 | 72 6f 6d 20 74 68 69 73 |ations f|rom this|
|00002b00| 20 70 72 61 63 74 69 63 | 65 20 77 69 6c 6c 20 72 | practic|e will r|
|00002b10| 65 73 75 6c 74 20 69 6e | 20 73 65 76 65 72 65 20 |esult in| severe |
|00002b20| 69 6e 74 65 72 72 75 70 | 74 20 6c 61 74 65 6e 63 |interrup|t latenc|
|00002b30| 79 20 6f 72 20 65 76 65 | 6e 20 73 79 73 74 65 6d |y or eve|n system|
|00002b40| 20 68 61 6e 67 73 2e 0d | 57 68 61 74 20 54 68 65 | hangs..|What The|
|00002b50| 20 47 6c 75 65 20 44 6f | 0d 48 69 67 68 2d 6c 65 | Glue Do|.High-le|
|00002b60| 76 65 6c 20 6c 61 6e 67 | 75 61 67 65 73 20 6f 66 |vel lang|uages of|
|00002b70| 74 65 6e 20 63 6f 6d 65 | 20 77 69 74 68 20 6c 69 |ten come| with li|
|00002b80| 62 72 61 72 69 65 73 20 | 74 68 61 74 20 70 72 6f |braries |that pro|
|00002b90| 76 69 64 65 20 61 6e 20 | 65 61 73 79 2d 74 6f 2d |vide an |easy-to-|
|00002ba0| 75 73 65 20 69 6e 74 65 | 72 66 61 63 65 20 28 d2 |use inte|rface (.|
|00002bb0| 67 6c 75 65 d3 29 20 74 | 6f 20 74 68 65 20 6d 61 |glue.) t|o the ma|
|00002bc0| 63 68 69 6e 65 2d 6c 65 | 76 65 6c 20 44 65 76 69 |chine-le|vel Devi|
|00002bd0| 63 65 20 4d 61 6e 61 67 | 65 72 20 74 72 61 70 73 |ce Manag|er traps|
|00002be0| 2e 20 4d 61 6e 79 20 6f | 66 20 74 68 65 73 65 20 |. Many o|f these |
|00002bf0| 63 61 6c 6c 73 20 61 72 | 65 20 64 6f 63 75 6d 65 |calls ar|e docume|
|00002c00| 6e 74 65 64 20 69 6e 20 | 49 6e 73 69 64 65 20 4d |nted in |Inside M|
|00002c10| 61 63 69 6e 74 6f 73 68 | 2e 20 54 68 65 73 65 20 |acintosh|. These |
|00002c20| 72 6f 75 74 69 6e 65 73 | 20 61 72 65 20 66 75 72 |routines| are fur|
|00002c30| 74 68 65 72 20 64 69 76 | 69 64 65 64 20 69 6e 74 |ther div|ided int|
|00002c40| 6f 20 74 77 6f 20 67 72 | 6f 75 70 73 2e 20 54 68 |o two gr|oups. Th|
|00002c50| 65 20 66 69 72 73 74 20 | 67 72 6f 75 70 20 69 73 |e first |group is|
|00002c60| 20 63 6f 6d 70 6f 73 65 | 64 20 6f 66 20 d2 6c 6f | compose|d of .lo|
|00002c70| 77 2d 6c 65 76 65 6c d3 | 20 72 6f 75 74 69 6e 65 |w-level.| routine|
|00002c80| 73 3b 20 74 68 65 73 65 | 20 72 6f 75 74 69 6e 65 |s; these| routine|
|00002c90| 73 20 74 61 6b 65 20 61 | 6e 20 61 6c 72 65 61 64 |s take a|n alread|
|00002ca0| 79 20 63 6f 6d 70 6c 65 | 74 65 20 70 61 72 61 6d |y comple|te param|
|00002cb0| 65 74 65 72 20 62 6c 6f | 63 6b 20 70 61 73 73 65 |eter blo|ck passe|
|00002cc0| 64 20 74 6f 20 74 68 65 | 6d 2c 20 70 6f 69 6e 74 |d to the|m, point|
|00002cd0| 20 72 65 67 69 73 74 65 | 72 20 41 30 20 61 74 20 | registe|r A0 at |
|00002ce0| 69 74 2c 20 61 6e 64 20 | 65 78 65 63 75 74 65 20 |it, and |execute |
|00002cf0| 74 68 65 20 70 72 6f 70 | 65 72 20 74 72 61 70 20 |the prop|er trap |
|00002d00| 77 69 74 68 20 74 68 65 | 20 63 6f 72 72 65 63 74 |with the| correct|
|00002d10| 20 6d 6f 64 65 2e 20 54 | 68 65 20 73 65 63 6f 6e | mode. T|he secon|
|00002d20| 64 20 67 72 6f 75 70 20 | 69 73 20 63 6f 6d 70 6f |d group |is compo|
|00002d30| 73 65 64 20 6f 66 20 d2 | 68 69 67 68 2d 6c 65 76 |sed of .|high-lev|
|00002d40| 65 6c d3 20 72 6f 75 74 | 69 6e 65 73 2c 20 77 68 |el. rout|ines, wh|
|00002d50| 69 63 68 20 73 65 74 20 | 75 70 20 61 20 70 61 72 |ich set |up a par|
|00002d60| 61 6d 65 74 65 72 20 62 | 6c 6f 63 6b 20 61 6e 64 |ameter b|lock and|
|00002d70| 20 72 65 71 75 69 72 65 | 64 20 72 65 67 69 73 74 | require|d regist|
|00002d80| 65 72 73 20 77 69 74 68 | 20 64 61 74 61 20 70 72 |ers with| data pr|
|00002d90| 6f 76 69 64 65 64 20 69 | 6e 20 74 68 65 20 63 61 |ovided i|n the ca|
|00002da0| 6c 6c 20 70 61 72 61 6d | 65 74 65 72 73 2c 20 74 |ll param|eters, t|
|00002db0| 68 65 6e 20 65 78 65 63 | 75 74 65 20 74 68 65 20 |hen exec|ute the |
|00002dc0| 44 65 76 69 63 65 20 4d | 61 6e 61 67 65 72 20 74 |Device M|anager t|
|00002dd0| 72 61 70 73 2e 20 46 6f | 72 20 65 78 61 6d 70 6c |raps. Fo|r exampl|
|00002de0| 65 2c 20 74 68 65 20 4f | 70 65 6e 44 72 69 76 65 |e, the O|penDrive|
|00002df0| 72 20 63 61 6c 6c 20 63 | 72 65 61 74 65 73 20 61 |r call c|reates a|
|00002e00| 20 70 61 72 61 6d 65 74 | 65 72 20 62 6c 6f 63 6b | paramet|er block|
|00002e10| 20 6f 6e 20 74 68 65 20 | 73 74 61 63 6b 2c 20 63 | on the |stack, c|
|00002e20| 6f 6d 70 6c 65 74 65 73 | 20 74 68 65 20 72 65 71 |ompletes| the req|
|00002e30| 75 69 72 65 64 20 66 69 | 65 6c 64 73 2c 20 70 6f |uired fi|elds, po|
|00002e40| 69 6e 74 73 20 72 65 67 | 69 73 74 65 72 20 41 30 |ints reg|ister A0|
|00002e50| 20 74 6f 20 74 68 65 20 | 62 6c 6f 63 6b 2c 20 61 | to the |block, a|
|00002e60| 6e 64 20 65 78 65 63 75 | 74 65 73 20 74 68 65 20 |nd execu|tes the |
|00002e70| 5f 4f 70 65 6e 20 74 72 | 61 70 2e 0d 46 6f 6c 6c |_Open tr|ap..Foll|
|00002e80| 6f 77 69 6e 67 20 69 73 | 20 61 20 6c 69 73 74 20 |owing is| a list |
|00002e90| 6f 66 20 68 69 67 68 2d | 6c 65 76 65 6c 20 72 6f |of high-|level ro|
|00002ea0| 75 74 69 6e 65 73 20 61 | 6e 64 20 74 68 65 20 74 |utines a|nd the t|
|00002eb0| 72 61 70 20 67 6c 75 65 | 20 74 68 65 79 20 65 78 |rap glue| they ex|
|00002ec0| 65 63 75 74 65 3a 0d 52 | 6f 75 74 69 6e 65 09 54 |ecute:.R|outine.T|
|00002ed0| 72 61 70 0d 4f 70 65 6e | 44 72 69 76 65 72 09 5f |rap.Open|Driver._|
|00002ee0| 4f 70 65 6e 0d 43 6c 6f | 73 65 44 72 69 76 65 72 |Open.Clo|seDriver|
|00002ef0| 09 5f 43 6c 6f 73 65 0d | 46 53 52 65 61 64 09 5f |._Close.|FSRead._|
|00002f00| 52 65 61 64 0d 46 53 57 | 72 69 74 65 09 5f 57 72 |Read.FSW|rite._Wr|
|00002f10| 69 74 65 0d 43 6f 6e 74 | 72 6f 6c 09 5f 43 6f 6e |ite.Cont|rol._Con|
|00002f20| 74 72 6f 6c 0d 53 74 61 | 74 75 73 09 5f 53 74 61 |trol.Sta|tus._Sta|
|00002f30| 74 75 73 0d 4b 69 6c 6c | 49 4f 09 5f 4b 69 6c 6c |tus.Kill|IO._Kill|
|00002f40| 49 4f 0d 59 65 73 2c 20 | 57 65 d5 72 65 20 4f 70 |IO.Yes, |We.re Op|
|00002f50| 65 6e 0d 54 68 65 20 4f | 70 65 6e 20 72 6f 75 74 |en.The O|pen rout|
|00002f60| 69 6e 65 20 6f 66 20 61 | 20 64 65 76 69 63 65 20 |ine of a| device |
|00002f70| 64 72 69 76 65 72 20 69 | 73 20 63 61 6c 6c 65 64 |driver i|s called|
|00002f80| 20 61 73 20 61 20 72 65 | 73 75 6c 74 20 6f 66 20 | as a re|sult of |
|00002f90| 61 6e 20 5f 4f 70 65 6e | 20 74 72 61 70 20 62 65 |an _Open| trap be|
|00002fa0| 69 6e 67 20 65 78 65 63 | 75 74 65 64 2e 20 57 68 |ing exec|uted. Wh|
|00002fb0| 61 74 20 5f 4f 70 65 6e | 20 64 6f 65 73 20 64 65 |at _Open| does de|
|00002fc0| 70 65 6e 64 73 20 75 70 | 6f 6e 20 77 68 61 74 20 |pends up|on what |
|00002fd0| 6d 61 63 68 69 6e 65 20 | 69 73 20 72 75 6e 6e 69 |machine |is runni|
|00002fe0| 6e 67 2c 20 62 75 74 20 | 69 73 20 66 61 69 72 6c |ng, but |is fairl|
|00002ff0| 79 20 63 6f 6e 73 69 73 | 74 65 6e 74 20 61 63 72 |y consis|tent acr|
|00003000| 6f 73 73 20 74 68 65 20 | 6d 61 63 68 69 6e 65 20 |oss the |machine |
|00003010| 6d 6f 64 65 6c 73 2c 20 | 77 69 74 68 20 74 68 65 |models, |with the|
|00003020| 20 65 78 63 65 70 74 69 | 6f 6e 20 6f 66 20 4e 75 | excepti|on of Nu|
|00003030| 62 75 73 aa 20 73 6c 6f | 74 20 64 72 69 76 65 72 |bus. slo|t driver|
|00003040| 73 20 6f 6e 20 61 20 4d | 61 63 69 6e 74 6f 73 68 |s on a M|acintosh|
|00003050| 20 77 69 74 68 20 61 20 | 53 6c 6f 74 20 4d 61 6e | with a |Slot Man|
|00003060| 61 67 65 72 2e 20 54 68 | 65 20 66 6f 6c 6c 6f 77 |ager. Th|e follow|
|00003070| 69 6e 67 20 69 73 20 61 | 20 70 73 65 75 64 6f 2d |ing is a| pseudo-|
|00003080| 63 6f 64 65 20 64 65 73 | 63 72 69 70 74 69 6f 6e |code des|cription|
|00003090| 20 66 6f 6c 6c 6f 77 65 | 64 20 62 79 20 61 20 6e | followe|d by a n|
|000030a0| 61 72 72 61 74 69 76 65 | 3a 0d 49 46 20 63 61 6c |arrative|:.IF cal|
|000030b0| 6c 20 69 73 20 4e 4f 54 | 20 66 72 6f 6d 20 5f 4f |l is NOT| from _O|
|000030c0| 70 65 6e 44 65 73 6b 41 | 63 63 20 41 4e 44 20 66 |penDeskA|cc AND f|
|000030d0| 69 6c 65 6e 61 6d 65 20 | 64 6f 65 73 20 4e 4f 54 |ilename |does NOT|
|000030e0| 20 62 65 67 69 6e 20 77 | 69 74 68 20 d2 2e d3 20 | begin w|ith ... |
|000030f0| 54 48 45 4e 0d 20 20 20 | 20 70 61 73 73 20 63 6f |THEN. | pass co|
|00003100| 6e 74 72 6f 6c 20 74 6f | 20 66 69 6c 65 20 73 79 |ntrol to| file sy|
|00003110| 73 74 65 6d 0d 45 4c 53 | 45 20 5b 0d 20 20 20 20 |stem.ELS|E [. |
|00003120| 49 46 20 64 72 69 76 65 | 72 20 69 73 20 66 6f 72 |IF drive|r is for|
|00003130| 20 73 6c 6f 74 20 64 65 | 76 69 63 65 20 54 48 45 | slot de|vice THE|
|00003140| 4e 20 5b 20 20 20 20 7b | 65 78 70 6c 61 69 6e 65 |N [ {|explaine|
|00003150| 64 20 69 6e 20 6e 61 72 | 72 61 74 69 76 65 20 62 |d in nar|rative b|
|00003160| 65 6c 6f 77 7d 0d 20 20 | 20 20 20 20 20 20 73 65 |elow}. | se|
|00003170| 61 72 63 68 20 75 6e 69 | 74 20 74 61 62 6c 65 20 |arch uni|t table |
|00003180| 66 72 6f 6d 20 34 38 20 | 74 68 72 6f 75 67 68 20 |from 48 |through |
|00003190| 55 6e 69 74 4e 74 72 79 | 43 6e 74 20 66 6f 72 20 |UnitNtry|Cnt for |
|000031a0| 6d 61 74 63 68 0d 20 20 | 20 20 20 20 20 20 49 46 |match. | IF|
|000031b0| 20 4e 4f 54 20 66 6f 75 | 6e 64 20 54 48 45 4e 0d | NOT fou|nd THEN.|
|000031c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 63 61 6c 6c | | call|
|000031d0| 20 5f 47 65 74 4e 61 6d | 65 64 52 65 73 6f 75 72 | _GetNam|edResour|
|000031e0| 63 65 20 66 6f 72 20 64 | 72 69 76 65 72 20 6e 61 |ce for d|river na|
|000031f0| 6d 65 20 74 79 70 65 20 | 27 44 52 56 52 27 0d 20 |me type |'DRVR'. |
|00003200| 20 20 20 20 20 20 20 49 | 46 20 4e 4f 54 20 73 75 | I|F NOT su|
|00003210| 63 63 65 73 73 66 75 6c | 20 54 48 45 4e 0d 20 20 |ccessful| THEN. |
|00003220| 20 20 20 20 20 20 20 20 | 20 20 63 61 6c 6c 20 5f | | call _|
|00003230| 53 47 65 74 44 72 69 76 | 65 72 20 66 6f 72 20 64 |SGetDriv|er for d|
|00003240| 72 69 76 65 72 0d 20 20 | 20 20 20 20 20 20 49 46 |river. | IF|
|00003250| 20 4e 4f 54 20 73 75 63 | 63 65 73 73 66 75 6c 20 | NOT suc|cessful |
|00003260| 54 48 45 4e 0d 20 20 20 | 20 20 20 20 20 20 20 20 |THEN. | |
|00003270| 20 72 65 74 75 72 6e 20 | 65 72 72 6f 72 0d 20 20 | return |error. |
|00003280| 20 20 20 20 20 20 7b 66 | 6f 75 6e 64 20 74 68 65 | {f|ound the|
|00003290| 20 64 72 69 76 65 72 7d | 0d 20 20 20 20 20 20 20 | driver}|. |
|000032a0| 20 73 65 61 72 63 68 20 | 75 6e 69 74 20 74 61 62 | search |unit tab|
|000032b0| 6c 65 20 66 72 6f 6d 20 | 34 38 20 74 68 72 6f 75 |le from |48 throu|
|000032c0| 67 68 20 55 6e 69 74 4e | 74 72 79 43 6e 74 20 66 |gh UnitN|tryCnt f|
|000032d0| 6f 72 20 4e 49 4c 20 44 | 43 45 20 68 61 6e 64 6c |or NIL D|CE handl|
|000032e0| 65 0d 20 20 20 20 20 20 | 20 20 49 46 20 4e 4f 54 |e. | IF NOT|
|000032f0| 20 66 6f 75 6e 64 20 54 | 48 45 4e 20 5b 0d 20 20 | found T|HEN [. |
|00003300| 20 20 20 20 20 20 20 20 | 20 20 62 75 6d 70 20 75 | | bump u|
|00003310| 70 20 55 6e 69 74 4e 74 | 72 79 43 6e 74 20 62 79 |p UnitNt|ryCnt by|
|00003320| 20 34 0d 20 20 20 20 20 | 20 20 20 20 20 20 20 49 | 4. | I|
|00003330| 46 20 6d 61 78 69 6d 75 | 6d 20 55 6e 69 74 4e 74 |F maximu|m UnitNt|
|00003340| 72 79 43 6e 74 20 65 78 | 63 65 65 64 65 64 20 54 |ryCnt ex|ceeded T|
|00003350| 48 45 4e 0d 20 20 20 20 | 20 20 20 20 20 20 20 20 |HEN. | |
|00003360| 20 20 20 20 72 65 74 75 | 72 6e 20 65 72 72 6f 72 | retu|rn error|
|00003370| 20 5d 0d 20 20 20 20 20 | 20 20 20 7b 66 6f 75 6e | ]. | {foun|
|00003380| 64 20 61 20 73 6c 6f 74 | 7d 0d 20 20 20 20 20 20 |d a slot|}. |
|00003390| 20 20 69 6e 73 74 61 6c | 6c 20 64 72 69 76 65 72 | instal|l driver|
|000033a0| 20 5d 0d 20 20 20 20 45 | 4c 53 45 20 5b 0d 20 20 | ]. E|LSE [. |
|000033b0| 20 20 20 20 20 20 73 65 | 61 72 63 68 20 75 6e 69 | se|arch uni|
|000033c0| 74 20 74 61 62 6c 65 20 | 66 72 6f 6d 20 30 20 74 |t table |from 0 t|
|000033d0| 68 72 6f 75 67 68 20 55 | 6e 69 74 4e 74 72 79 43 |hrough U|nitNtryC|
|000033e0| 6e 74 20 66 6f 72 20 6d | 61 74 63 68 0d 20 20 20 |nt for m|atch. |
|000033f0| 20 20 20 20 20 49 46 20 | 4e 4f 54 20 66 6f 75 6e | IF |NOT foun|
|00003400| 64 20 54 48 45 4e 0d 20 | 20 20 20 20 20 20 20 20 |d THEN. | |
|00003410| 20 20 20 63 61 6c 6c 20 | 5f 47 65 74 4e 61 6d 65 | call |_GetName|
|00003420| 64 52 65 73 6f 75 72 63 | 65 20 66 6f 72 20 64 72 |dResourc|e for dr|
|00003430| 69 76 65 72 20 6e 61 6d | 65 20 74 79 70 65 20 27 |iver nam|e type '|
|00003440| 44 52 56 52 27 0d 20 20 | 20 20 20 20 20 20 49 46 |DRVR'. | IF|
|00003450| 20 4e 4f 54 20 73 75 63 | 63 65 73 73 66 75 6c 20 | NOT suc|cessful |
|00003460| 54 48 45 4e 0d 20 20 20 | 20 20 20 20 20 20 20 20 |THEN. | |
|00003470| 20 72 65 74 75 72 6e 20 | 65 72 72 6f 72 0d 20 20 | return |error. |
|00003480| 20 20 20 20 20 20 7b 66 | 6f 75 6e 64 20 64 72 69 | {f|ound dri|
|00003490| 76 65 72 7d 0d 20 20 20 | 20 20 20 20 20 67 65 74 |ver}. | get|
|000034a0| 20 72 65 73 6f 75 72 63 | 65 20 49 44 20 6f 66 20 | resourc|e ID of |
|000034b0| 27 44 52 56 52 27 20 72 | 65 73 6f 75 72 63 65 0d |'DRVR' r|esource.|
|000034c0| 20 20 20 20 20 20 20 20 | 49 46 20 75 6e 69 74 20 | |IF unit |
|000034d0| 6e 75 6d 62 65 72 20 6e | 6f 74 20 61 6c 72 65 61 |number n|ot alrea|
|000034e0| 64 79 20 69 6e 20 75 73 | 65 20 54 48 45 4e 0d 20 |dy in us|e THEN. |
|000034f0| 20 20 20 20 20 20 20 20 | 20 20 20 69 6e 73 74 61 | | insta|
|00003500| 6c 6c 20 64 72 69 76 65 | 72 20 5d 20 20 20 20 7b |ll drive|r ] {|
|00003510| 6f 74 68 65 72 77 69 73 | 65 2c 20 6c 65 61 76 65 |otherwis|e, leave|
|00003520| 20 6f 6c 64 20 64 72 69 | 76 65 72 20 74 68 65 72 | old dri|ver ther|
|00003530| 65 7d 0d 20 20 20 20 49 | 46 20 64 72 69 76 65 72 |e}. I|F driver|
|00003540| 20 4e 4f 54 20 61 6c 72 | 65 61 64 79 20 6f 70 65 | NOT alr|eady ope|
|00003550| 6e 20 54 48 45 4e 20 5b | 0d 20 20 20 20 20 20 20 |n THEN [|. |
|00003560| 20 6d 6f 76 65 20 44 72 | 76 72 20 66 69 65 6c 64 | move Dr|vr field|
|00003570| 73 20 69 6e 74 6f 20 63 | 6f 72 72 65 73 70 6f 6e |s into c|orrespon|
|00003580| 64 69 6e 67 20 44 43 45 | 20 66 69 65 6c 64 73 0d |ding DCE| fields.|
|00003590| 20 20 20 20 20 20 20 20 | 49 46 20 64 72 69 76 65 | |IF drive|
|000035a0| 72 20 69 73 20 52 41 4d | 2d 62 61 73 65 64 20 54 |r is RAM|-based T|
|000035b0| 48 45 4e 0d 20 20 20 20 | 20 20 20 20 20 20 20 20 |HEN. | |
|000035c0| 73 65 74 20 52 41 4d 2d | 62 61 73 65 64 20 66 6c |set RAM-|based fl|
|000035d0| 61 67 20 69 6e 20 64 43 | 74 6c 46 6c 61 67 73 20 |ag in dC|tlFlags |
|000035e0| 66 69 65 6c 64 20 6f 66 | 20 44 43 45 0d 20 20 20 |field of| DCE. |
|000035f0| 20 20 20 20 20 49 46 20 | 64 72 69 76 65 72 20 69 | IF |driver i|
|00003600| 73 20 66 6f 72 20 73 6c | 6f 74 20 64 65 76 69 63 |s for sl|ot devic|
|00003610| 65 20 54 48 45 4e 0d 20 | 20 20 20 20 20 20 20 20 |e THEN. | |
|00003620| 20 20 20 63 61 6c 6c 20 | 5f 53 46 69 6e 64 44 65 | call |_SFindDe|
|00003630| 76 42 61 73 65 20 61 6e | 64 20 70 75 74 20 72 65 |vBase an|d put re|
|00003640| 73 75 6c 74 20 69 6e 74 | 6f 20 44 43 45 20 5d 0d |sult int|o DCE ].|
|00003650| 20 20 20 20 49 46 20 64 | 72 69 76 65 72 20 6e 65 | IF d|river ne|
|00003660| 65 64 73 4c 6f 63 6b 20 | 54 48 45 4e 0d 20 20 20 |edsLock |THEN. |
|00003670| 20 20 20 20 20 6c 6f 63 | 6b 20 64 72 69 76 65 72 | loc|k driver|
|00003680| 20 61 6e 64 20 44 43 45 | 0d 20 20 20 20 49 46 20 | and DCE|. IF |
|00003690| 64 72 69 76 65 72 20 4e | 4f 54 20 61 6c 72 65 61 |driver N|OT alrea|
|000036a0| 64 79 20 6f 70 65 6e 20 | 4f 52 20 63 61 6c 6c 65 |dy open |OR calle|
|000036b0| 64 20 66 72 6f 6d 20 5f | 4f 70 65 6e 44 65 73 6b |d from _|OpenDesk|
|000036c0| 41 63 63 20 54 48 45 4e | 0d 20 20 20 20 20 20 20 |Acc THEN|. |
|000036d0| 20 63 61 6c 6c 20 4f 70 | 65 6e 20 72 6f 75 74 69 | call Op|en routi|
|000036e0| 6e 65 20 6f 66 20 64 72 | 69 76 65 72 0d 20 20 20 |ne of dr|iver. |
|000036f0| 20 49 46 20 61 6e 79 20 | 65 72 72 6f 72 20 72 65 | IF any |error re|
|00003700| 73 75 6c 74 65 64 20 54 | 48 45 4e 20 5b 0d 20 20 |sulted T|HEN [. |
|00003710| 20 20 20 20 20 20 63 6c | 65 61 72 20 69 6f 52 65 | cl|ear ioRe|
|00003720| 66 6e 75 6d 20 66 69 65 | 6c 64 0d 20 20 20 20 20 |fnum fie|ld. |
|00003730| 20 20 20 63 6c 65 61 72 | 20 64 72 69 76 65 72 4f | clear| driverO|
|00003740| 70 65 6e 20 62 69 74 20 | 6f 66 20 64 43 74 6c 46 |pen bit |of dCtlF|
|00003750| 6c 61 67 73 0d 20 20 20 | 20 20 20 20 20 75 6e 6c |lags. | unl|
|00003760| 6f 63 6b 20 64 72 69 76 | 65 72 20 61 6e 64 20 44 |ock driv|er and D|
|00003770| 43 45 20 5d 0d 20 20 20 | 20 45 4c 53 45 0d 20 20 |CE ]. | ELSE. |
|00003780| 20 20 20 20 20 20 75 6e | 6c 6f 63 6b 20 64 72 69 | un|lock dri|
|00003790| 76 65 72 20 61 6e 64 20 | 44 43 45 20 69 66 20 61 |ver and |DCE if a|
|000037a0| 6c 6c 6f 77 65 64 0d 20 | 20 20 20 73 65 74 20 69 |llowed. | set i|
|000037b0| 6f 52 65 73 75 6c 74 20 | 66 69 65 6c 64 20 74 6f |oResult |field to|
|000037c0| 20 72 65 73 75 6c 74 20 | 5d 0d 46 69 72 73 74 2c | result |].First,|
|000037d0| 20 5f 4f 70 65 6e 20 63 | 68 65 63 6b 73 20 74 6f | _Open c|hecks to|
|000037e0| 20 73 65 65 20 69 66 20 | 74 68 65 20 63 61 6c 6c | see if |the call|
|000037f0| 20 69 73 20 66 72 6f 6d | 20 5f 4f 70 65 6e 44 65 | is from| _OpenDe|
|00003800| 73 6b 41 63 63 2e 20 54 | 68 69 73 20 63 68 65 63 |skAcc. T|his chec|
|00003810| 6b 20 69 73 20 6d 61 64 | 65 20 62 79 20 6c 6f 6f |k is mad|e by loo|
|00003820| 6b 69 6e 67 20 66 6f 72 | 20 61 20 73 70 65 63 69 |king for| a speci|
|00003830| 61 6c 20 76 61 6c 75 65 | 20 69 6e 20 74 68 65 20 |al value| in the |
|00003840| 69 6f 46 69 6c 65 54 79 | 70 65 20 66 69 65 6c 64 |ioFileTy|pe field|
|00003850| 20 6f 66 20 74 68 65 20 | 70 61 72 61 6d 65 74 65 | of the |paramete|
|00003860| 72 20 62 6c 6f 63 6b 2c | 20 77 68 69 63 68 20 5f |r block,| which _|
|00003870| 4f 70 65 6e 44 65 73 6b | 41 63 63 20 73 65 74 73 |OpenDesk|Acc sets|
|00003880| 2e 20 54 68 65 20 66 69 | 6c 65 6e 61 6d 65 20 73 |. The fi|lename s|
|00003890| 68 6f 75 6c 64 20 61 6c | 73 6f 20 62 65 67 69 6e |hould al|so begin|
|000038a0| 20 77 69 74 68 20 61 20 | 6e 75 6c 6c 20 62 79 74 | with a |null byt|
|000038b0| 65 20 28 24 30 30 29 2c | 20 62 75 74 20 74 68 69 |e ($00),| but thi|
|000038c0| 73 20 69 73 20 6e 6f 74 | 20 63 68 65 63 6b 65 64 |s is not| checked|
|000038d0| 2e 20 49 66 20 74 68 65 | 20 63 61 6c 6c 20 69 73 |. If the| call is|
|000038e0| 20 6e 6f 74 20 66 72 6f | 6d 20 5f 4f 70 65 6e 44 | not fro|m _OpenD|
|000038f0| 65 73 6b 41 63 63 2c 20 | 5f 4f 70 65 6e 20 63 68 |eskAcc, |_Open ch|
|00003900| 65 63 6b 73 20 74 6f 20 | 73 65 65 20 69 66 20 74 |ecks to |see if t|
|00003910| 68 65 20 66 69 6c 65 6e | 61 6d 65 20 69 6e 20 74 |he filen|ame in t|
|00003920| 68 65 20 70 61 72 61 6d | 65 74 65 72 20 62 6c 6f |he param|eter blo|
|00003930| 63 6b 20 62 65 67 69 6e | 73 20 77 69 74 68 20 61 |ck begin|s with a|
|00003940| 20 70 65 72 69 6f 64 20 | 28 2e 29 2e 20 49 66 20 | period |(.). If |
|00003950| 74 68 65 20 66 69 6c 65 | 6e 61 6d 65 20 64 6f 65 |the file|name doe|
|00003960| 73 20 6e 6f 74 20 62 65 | 67 69 6e 20 77 69 74 68 |s not be|gin with|
|00003970| 20 61 20 70 65 72 69 6f | 64 2c 20 63 6f 6e 74 72 | a perio|d, contr|
|00003980| 6f 6c 20 69 73 20 70 61 | 73 73 65 64 20 74 6f 20 |ol is pa|ssed to |
|00003990| 74 68 65 20 66 69 6c 65 | 20 73 79 73 74 65 6d 2e |the file| system.|
|000039a0| 20 4f 74 68 65 72 77 69 | 73 65 2c 20 69 66 20 74 | Otherwi|se, if t|
|000039b0| 68 65 20 6d 61 63 68 69 | 6e 65 20 69 73 20 61 20 |he machi|ne is a |
|000039c0| 4d 61 63 69 6e 74 6f 73 | 68 20 77 69 74 68 20 74 |Macintos|h with t|
|000039d0| 68 65 20 53 6c 6f 74 20 | 4d 61 6e 61 67 65 72 2c |he Slot |Manager,|
|000039e0| 20 74 68 65 6e 20 61 20 | 63 68 65 63 6b 20 69 73 | then a |check is|
|000039f0| 20 6d 61 64 65 20 74 6f | 20 73 65 65 20 69 66 20 | made to| see if |
|00003a00| 74 68 65 20 64 72 69 76 | 65 72 20 69 73 20 66 6f |the driv|er is fo|
|00003a10| 72 20 61 20 73 6c 6f 74 | 20 64 65 76 69 63 65 2e |r a slot| device.|
|00003a20| 20 49 66 20 62 69 74 20 | 39 20 6f 66 20 74 68 65 | If bit |9 of the|
|00003a30| 20 5f 4f 70 65 6e 20 74 | 72 61 70 20 77 6f 72 64 | _Open t|rap word|
|00003a40| 20 69 73 20 73 65 74 20 | 61 6e 64 20 62 69 74 20 | is set |and bit |
|00003a50| 30 20 6f 66 20 74 68 65 | 20 69 6f 46 6c 61 67 73 |0 of the| ioFlags|
|00003a60| 20 77 6f 72 64 20 69 73 | 20 73 65 74 20 6f 72 20 | word is| set or |
|00003a70| 74 68 65 20 69 6f 53 6c | 6f 74 20 66 69 65 6c 64 |the ioSl|ot field|
|00003a80| 20 6f 66 20 74 68 65 20 | 70 61 72 61 6d 65 74 65 | of the |paramete|
|00003a90| 72 20 62 6c 6f 63 6b 20 | 69 73 20 6e 6f 74 20 7a |r block |is not z|
|00003aa0| 65 72 6f 2c 20 74 68 65 | 6e 20 74 68 65 20 64 72 |ero, the|n the dr|
|00003ab0| 69 76 65 72 20 69 73 20 | 61 73 73 75 6d 65 64 20 |iver is |assumed |
|00003ac0| 74 6f 20 62 65 20 66 6f | 72 20 61 20 73 6c 6f 74 |to be fo|r a slot|
|00003ad0| 20 64 65 76 69 63 65 2e | 0d 49 66 20 74 68 65 20 | device.|.If the |
|00003ae0| 64 72 69 76 65 72 20 69 | 73 20 66 6f 72 20 61 20 |driver i|s for a |
|00003af0| 73 6c 6f 74 20 64 65 76 | 69 63 65 2c 20 74 68 65 |slot dev|ice, the|
|00003b00| 20 75 6e 69 74 20 74 61 | 62 6c 65 20 69 73 20 73 | unit ta|ble is s|
|00003b10| 65 61 72 63 68 65 64 2c | 20 73 74 61 72 74 69 6e |earched,| startin|
|00003b20| 67 20 61 74 20 75 6e 69 | 74 20 6e 75 6d 62 65 72 |g at uni|t number|
|00003b30| 20 34 38 20 61 6e 64 20 | 65 6e 64 69 6e 67 20 61 | 48 and |ending a|
|00003b40| 74 20 55 6e 69 74 4e 74 | 72 79 43 6e 74 2e 20 49 |t UnitNt|ryCnt. I|
|00003b50| 66 20 74 68 65 20 64 43 | 74 6c 53 6c 6f 74 2c 20 |f the dC|tlSlot, |
|00003b60| 64 43 74 6c 53 6c 6f 74 | 49 44 2c 20 61 6e 64 20 |dCtlSlot|ID, and |
|00003b70| 64 43 74 6c 45 78 74 44 | 65 76 20 66 69 65 6c 64 |dCtlExtD|ev field|
|00003b80| 73 20 6f 66 20 6e 6f 6e | 65 20 6f 66 20 74 68 65 |s of non|e of the|
|00003b90| 20 44 43 45 73 20 6f 66 | 20 74 68 65 20 75 6e 69 | DCEs of| the uni|
|00003ba0| 74 20 6e 75 6d 62 65 72 | 73 20 6d 61 74 63 68 20 |t number|s match |
|00003bb0| 74 68 65 20 66 69 65 6c | 64 73 20 6f 66 20 74 68 |the fiel|ds of th|
|00003bc0| 65 20 70 61 72 61 6d 65 | 74 65 72 20 62 6c 6f 63 |e parame|ter bloc|
|00003bd0| 6b 2c 20 74 68 65 6e 20 | 5f 47 65 74 4e 61 6d 65 |k, then |_GetName|
|00003be0| 64 52 65 73 6f 75 72 63 | 65 20 69 73 20 63 61 6c |dResourc|e is cal|
|00003bf0| 6c 65 64 2c 20 75 73 69 | 6e 67 20 74 68 65 20 6e |led, usi|ng the n|
|00003c00| 61 6d 65 20 6f 66 20 74 | 68 65 20 64 72 69 76 65 |ame of t|he drive|
|00003c10| 72 20 61 6e 64 20 74 79 | 70 65 20 27 44 52 56 52 |r and ty|pe 'DRVR|
|00003c20| 27 2e 20 49 66 20 74 68 | 61 74 20 66 61 69 6c 73 |'. If th|at fails|
|00003c30| 2c 20 74 68 65 6e 20 5f | 53 47 65 74 44 72 69 76 |, then _|SGetDriv|
|00003c40| 65 72 20 69 73 20 63 61 | 6c 6c 65 64 20 74 6f 20 |er is ca|lled to |
|00003c50| 6c 6f 61 64 20 74 68 65 | 20 64 72 69 76 65 72 20 |load the| driver |
|00003c60| 66 72 6f 6d 20 74 68 65 | 20 63 61 72 64 d5 73 20 |from the| card.s |
|00003c70| 52 4f 4d 2e 20 49 66 20 | 74 68 61 74 20 61 74 74 |ROM. If |that att|
|00003c80| 65 6d 70 74 20 66 61 69 | 6c 73 2c 20 61 6e 20 65 |empt fai|ls, an e|
|00003c90| 72 72 6f 72 20 69 73 20 | 72 65 70 6f 72 74 65 64 |rror is |reported|
|00003ca0| 2e 20 49 6e 20 74 68 65 | 20 63 61 73 65 20 77 68 |. In the| case wh|
|00003cb0| 65 72 65 20 6f 6e 65 20 | 6f 66 20 74 68 65 20 61 |ere one |of the a|
|00003cc0| 74 74 65 6d 70 74 73 20 | 73 75 63 63 65 65 64 73 |ttempts |succeeds|
|00003cd0| 2c 20 74 68 65 20 75 6e | 69 74 20 74 61 62 6c 65 |, the un|it table|
|00003ce0| 20 69 73 20 73 65 61 72 | 63 68 65 64 20 61 66 74 | is sear|ched aft|
|00003cf0| 65 72 20 6c 6f 61 64 69 | 6e 67 20 74 68 65 20 6e |er loadi|ng the n|
|00003d00| 65 77 20 64 72 69 76 65 | 72 2c 20 73 74 61 72 74 |ew drive|r, start|
|00003d10| 69 6e 67 20 61 74 20 75 | 6e 69 74 20 6e 75 6d 62 |ing at u|nit numb|
|00003d20| 65 72 20 34 38 20 61 6e | 64 20 65 6e 64 69 6e 67 |er 48 an|d ending|
|00003d30| 20 61 74 20 55 6e 69 74 | 4e 74 72 79 43 6e 74 2c | at Unit|NtryCnt,|
|00003d40| 20 66 6f 72 20 61 6e 20 | 75 6e 75 73 65 64 20 28 | for an |unused (|
|00003d50| 4e 49 4c 29 20 73 6c 6f | 74 2e 20 49 66 20 6e 6f |NIL) slo|t. If no|
|00003d60| 6e 65 20 61 72 65 20 66 | 6f 75 6e 64 2c 20 74 68 |ne are f|ound, th|
|00003d70| 65 20 76 61 6c 75 65 20 | 6f 66 20 55 6e 69 74 4e |e value |of UnitN|
|00003d80| 74 72 79 43 6e 74 20 69 | 73 20 69 6e 63 72 65 6d |tryCnt i|s increm|
|00003d90| 65 6e 74 65 64 20 62 79 | 20 66 6f 75 72 2e 20 49 |ented by| four. I|
|00003da0| 66 20 74 68 65 20 76 61 | 6c 75 65 20 65 78 63 65 |f the va|lue exce|
|00003db0| 65 64 73 20 31 32 38 2c | 20 74 68 65 6e 20 61 6e |eds 128,| then an|
|00003dc0| 20 65 72 72 6f 72 20 69 | 73 20 72 65 70 6f 72 74 | error i|s report|
|00003dd0| 65 64 2e 20 4f 74 68 65 | 72 77 69 73 65 20 64 72 |ed. Othe|rwise dr|
|00003de0| 69 76 65 72 20 75 73 65 | 73 20 74 68 65 20 6e 65 |iver use|s the ne|
|00003df0| 77 6c 79 20 63 72 65 61 | 74 65 64 20 73 6c 6f 74 |wly crea|ted slot|
|00003e00| 2e 0d 49 66 20 74 68 65 | 20 64 72 69 76 65 72 20 |..If the| driver |
|00003e10| 69 73 20 6e 6f 74 20 66 | 6f 72 20 61 20 73 6c 6f |is not f|or a slo|
|00003e20| 74 20 64 65 76 69 63 65 | 20 6f 72 20 68 61 73 20 |t device| or has |
|00003e30| 62 65 65 6e 20 64 65 74 | 65 72 6d 69 6e 65 64 20 |been det|ermined |
|00003e40| 74 6f 20 62 65 20 61 20 | 64 65 73 6b 20 61 63 63 |to be a |desk acc|
|00003e50| 65 73 73 6f 72 79 2c 20 | 74 68 65 20 75 6e 69 74 |essory, |the unit|
|00003e60| 20 74 61 62 6c 65 20 69 | 73 20 73 65 61 72 63 68 | table i|s search|
|00003e70| 65 64 2c 20 73 74 61 72 | 74 69 6e 67 20 61 74 20 |ed, star|ting at |
|00003e80| 75 6e 69 74 20 6e 75 6d | 62 65 72 20 30 20 61 6e |unit num|ber 0 an|
|00003e90| 64 20 65 6e 64 69 6e 67 | 20 61 74 20 55 6e 69 74 |d ending| at Unit|
|00003ea0| 4e 74 72 79 43 6e 74 2e | 20 49 66 20 6e 6f 6e 65 |NtryCnt.| If none|
|00003eb0| 20 6f 66 20 74 68 65 20 | 6e 61 6d 65 73 20 66 6f | of the |names fo|
|00003ec0| 72 20 74 68 65 20 69 6e | 73 74 61 6c 6c 65 64 20 |r the in|stalled |
|00003ed0| 64 72 69 76 65 72 73 20 | 69 6e 20 74 68 65 20 74 |drivers |in the t|
|00003ee0| 61 62 6c 65 20 6d 61 74 | 63 68 65 73 20 74 68 65 |able mat|ches the|
|00003ef0| 20 66 69 6c 65 6e 61 6d | 65 20 6f 66 20 74 68 65 | filenam|e of the|
|00003f00| 20 70 61 72 61 6d 65 74 | 65 72 20 62 6c 6f 63 6b | paramet|er block|
|00003f10| 2c 20 74 68 65 6e 20 5f | 47 65 74 4e 61 6d 65 64 |, then _|GetNamed|
|00003f20| 52 65 73 6f 75 72 63 65 | 20 69 73 20 63 61 6c 6c |Resource| is call|
|00003f30| 65 64 2c 20 75 73 69 6e | 67 20 74 68 65 20 6e 61 |ed, usin|g the na|
|00003f40| 6d 65 20 6f 66 20 74 68 | 65 20 64 72 69 76 65 72 |me of th|e driver|
|00003f50| 20 61 6e 64 20 74 79 70 | 65 20 27 44 52 56 52 27 | and typ|e 'DRVR'|
|00003f60| 2e 20 49 66 20 74 68 61 | 74 20 61 74 74 65 6d 70 |. If tha|t attemp|
|00003f70| 74 20 66 61 69 6c 73 2c | 20 61 6e 20 65 72 72 6f |t fails,| an erro|
|00003f80| 72 20 69 73 20 72 65 70 | 6f 72 74 65 64 2e 20 49 |r is rep|orted. I|
|00003f90| 66 20 74 68 65 20 61 74 | 74 65 6d 70 74 20 73 75 |f the at|tempt su|
|00003fa0| 63 63 65 65 64 73 2c 20 | 74 68 65 20 49 44 20 6f |cceeds, |the ID o|
|00003fb0| 66 20 74 68 65 20 72 65 | 73 6f 75 72 63 65 20 69 |f the re|source i|
|00003fc0| 73 20 61 73 73 75 6d 65 | 64 20 74 6f 20 62 65 20 |s assume|d to be |
|00003fd0| 74 68 65 20 75 6e 69 74 | 20 6e 75 6d 62 65 72 20 |the unit| number |
|00003fe0| 6f 66 20 74 68 65 20 64 | 72 69 76 65 72 20 61 6e |of the d|river an|
|00003ff0| 64 20 69 73 20 6d 61 70 | 70 65 64 20 69 6e 74 6f |d is map|ped into|
|00004000| 20 74 68 65 20 65 71 75 | 69 76 61 6c 65 6e 74 20 | the equ|ivalent |
|00004010| 72 65 66 6e 75 6d 2e 20 | 49 66 20 74 68 65 20 73 |refnum. |If the s|
|00004020| 6c 6f 74 20 66 6f 72 20 | 74 68 61 74 20 72 65 66 |lot for |that ref|
|00004030| 6e 75 6d 20 69 73 20 61 | 6c 72 65 61 64 79 20 6f |num is a|lready o|
|00004040| 63 63 75 70 69 65 64 2c | 20 74 68 65 6e 20 74 68 |ccupied,| then th|
|00004050| 65 20 64 72 69 76 65 72 | 20 74 68 61 74 20 69 73 |e driver| that is|
|00004060| 20 61 6c 72 65 61 64 79 | 20 74 68 65 72 65 20 72 | already| there r|
|00004070| 65 6d 61 69 6e 73 20 74 | 68 65 72 65 2e 0d 4f 6e |emains t|here..On|
|00004080| 63 65 20 74 68 65 20 64 | 65 76 69 63 65 20 64 72 |ce the d|evice dr|
|00004090| 69 76 65 72 20 69 73 20 | 69 6e 73 74 61 6c 6c 65 |iver is |installe|
|000040a0| 64 2c 20 6f 72 20 69 74 | 20 68 61 73 20 62 65 65 |d, or it| has bee|
|000040b0| 6e 20 64 65 74 65 72 6d | 69 6e 65 64 20 74 68 61 |n determ|ined tha|
|000040c0| 74 20 61 20 64 72 69 76 | 65 72 20 61 6c 72 65 61 |t a driv|er alrea|
|000040d0| 64 79 20 6f 63 63 75 70 | 69 65 73 20 74 68 65 20 |dy occup|ies the |
|000040e0| 73 6c 6f 74 20 69 6e 20 | 74 68 65 20 75 6e 69 74 |slot in |the unit|
|000040f0| 20 74 61 62 6c 65 2c 20 | 74 68 65 20 64 72 69 76 | table, |the driv|
|00004100| 65 72 20 69 73 20 63 68 | 65 63 6b 65 64 20 74 6f |er is ch|ecked to|
|00004110| 20 73 65 65 20 69 66 20 | 69 74 20 68 61 73 20 61 | see if |it has a|
|00004120| 6c 72 65 61 64 79 20 62 | 65 65 6e 20 6f 70 65 6e |lready b|een open|
|00004130| 65 64 2e 20 49 66 20 69 | 74 20 68 61 73 20 6e 6f |ed. If i|t has no|
|00004140| 74 2c 20 74 68 65 20 64 | 72 69 76 65 72 20 69 73 |t, the d|river is|
|00004150| 20 63 68 65 63 6b 65 64 | 20 74 6f 20 73 65 65 20 | checked| to see |
|00004160| 69 66 20 69 74 20 69 73 | 20 52 41 4d 2d 62 61 73 |if it is| RAM-bas|
|00004170| 65 64 20 6f 72 20 61 6e | 64 20 74 68 65 20 64 43 |ed or an|d the dC|
|00004180| 74 6c 46 6c 61 67 73 20 | 66 69 65 6c 64 20 6f 66 |tlFlags |field of|
|00004190| 20 74 68 65 20 64 72 69 | 76 65 72 d5 73 20 44 43 | the dri|ver.s DC|
|000041a0| 45 20 69 73 20 73 65 74 | 20 61 63 63 6f 72 64 69 |E is set| accordi|
|000041b0| 6e 67 6c 79 2c 20 61 6c | 6f 6e 67 20 77 69 74 68 |ngly, al|ong with|
|000041c0| 20 62 65 69 6e 67 20 63 | 6f 6d 62 69 6e 65 64 20 | being c|ombined |
|000041d0| 77 69 74 68 20 74 68 65 | 20 72 65 73 74 20 6f 66 |with the| rest of|
|000041e0| 20 74 68 65 20 44 72 76 | 72 46 6c 61 67 73 20 66 | the Drv|rFlags f|
|000041f0| 69 65 6c 64 20 6f 66 20 | 74 68 65 20 64 72 69 76 |ield of |the driv|
|00004200| 65 72 20 68 65 61 64 65 | 72 2e 20 54 68 65 20 44 |er heade|r. The D|
|00004210| 72 76 72 44 65 6c 61 79 | 2c 20 44 72 76 72 45 4d |rvrDelay|, DrvrEM|
|00004220| 61 73 6b 2c 20 61 6e 64 | 20 44 72 76 72 4d 65 6e |ask, and| DrvrMen|
|00004230| 75 20 66 69 65 6c 64 73 | 20 66 72 6f 6d 20 74 68 |u fields| from th|
|00004240| 65 20 64 72 69 76 65 72 | 20 68 65 61 64 65 72 20 |e driver| header |
|00004250| 61 72 65 20 61 6c 73 6f | 20 6d 6f 76 65 64 20 69 |are also| moved i|
|00004260| 6e 74 6f 20 74 68 65 20 | 63 6f 72 72 65 73 70 6f |nto the |correspo|
|00004270| 6e 64 69 6e 67 20 66 69 | 65 6c 64 73 20 6f 66 20 |nding fi|elds of |
|00004280| 74 68 65 20 44 43 45 2e | 20 49 66 20 74 68 65 20 |the DCE.| If the |
|00004290| 64 72 69 76 65 72 20 69 | 73 20 66 6f 72 20 61 20 |driver i|s for a |
|000042a0| 73 6c 6f 74 20 64 65 76 | 69 63 65 2c 20 5f 53 46 |slot dev|ice, _SF|
|000042b0| 69 6e 64 44 65 76 42 61 | 73 65 20 69 73 20 63 61 |indDevBa|se is ca|
|000042c0| 6c 6c 65 64 20 66 6f 72 | 20 74 68 65 20 73 6c 6f |lled for| the slo|
|000042d0| 74 20 61 6e 64 20 49 44 | 20 6f 66 20 74 68 65 20 |t and ID| of the |
|000042e0| 64 72 69 76 65 72 d5 73 | 20 64 65 76 69 63 65 20 |driver.s| device |
|000042f0| 61 6e 64 20 74 68 65 20 | 72 65 73 75 6c 74 20 69 |and the |result i|
|00004300| 73 20 70 75 74 20 69 6e | 74 6f 20 74 68 65 20 44 |s put in|to the D|
|00004310| 43 45 2e 0d 4f 6e 63 65 | 20 74 68 65 20 44 43 45 |CE..Once| the DCE|
|00004320| 20 66 69 65 6c 64 73 20 | 68 61 76 65 20 62 65 65 | fields |have bee|
|00004330| 6e 20 63 6f 6d 70 6c 65 | 74 65 64 2c 20 6f 72 20 |n comple|ted, or |
|00004340| 69 74 20 69 73 20 64 65 | 74 65 72 6d 69 6e 65 64 |it is de|termined|
|00004350| 20 74 68 61 74 20 74 68 | 65 20 64 72 69 76 65 72 | that th|e driver|
|00004360| 20 69 73 20 61 6c 72 65 | 61 64 79 20 6f 70 65 6e | is alre|ady open|
|00004370| 2c 20 74 68 65 20 64 72 | 69 76 65 72 20 61 6e 64 |, the dr|iver and|
|00004380| 20 44 43 45 20 61 72 65 | 20 6c 6f 63 6b 65 64 20 | DCE are| locked |
|00004390| 69 66 20 6e 65 65 64 65 | 64 2e 20 54 68 65 20 70 |if neede|d. The p|
|000043a0| 65 72 6d 69 73 73 69 6f | 6e 73 20 61 72 65 20 74 |ermissio|ns are t|
|000043b0| 68 65 6e 20 63 68 65 63 | 6b 65 64 2c 20 72 65 74 |hen chec|ked, ret|
|000043c0| 75 72 6e 69 6e 67 20 61 | 6e 20 65 72 72 6f 72 20 |urning a|n error |
|000043d0| 69 66 20 69 6e 63 6f 72 | 72 65 63 74 2c 20 61 6e |if incor|rect, an|
|000043e0| 64 20 74 68 65 20 4f 70 | 65 6e 20 72 6f 75 74 69 |d the Op|en routi|
|000043f0| 6e 65 20 6f 66 20 74 68 | 65 20 64 72 69 76 65 72 |ne of th|e driver|
|00004400| 20 69 73 20 63 61 6c 6c | 65 64 20 69 66 20 74 68 | is call|ed if th|
|00004410| 65 20 64 72 69 76 65 72 | 20 69 73 20 6e 6f 74 20 |e driver| is not |
|00004420| 61 6c 72 65 61 64 79 20 | 6f 70 65 6e 20 6f 72 20 |already |open or |
|00004430| 69 66 20 74 68 65 20 63 | 61 6c 6c 20 77 61 73 20 |if the c|all was |
|00004440| 66 72 6f 6d 20 5f 4f 70 | 65 6e 44 65 73 6b 41 63 |from _Op|enDeskAc|
|00004450| 63 2e 20 49 66 20 74 68 | 65 20 64 72 69 76 65 72 |c. If th|e driver|
|00004460| 20 72 65 74 75 72 6e 73 | 20 61 6e 79 20 65 72 72 | returns| any err|
|00004470| 6f 72 2c 20 74 68 65 6e | 20 74 68 65 20 69 6f 52 |or, then| the ioR|
|00004480| 65 73 75 6c 74 20 66 69 | 65 6c 64 20 6f 66 20 74 |esult fi|eld of t|
|00004490| 68 65 20 70 61 72 61 6d | 65 74 65 72 20 62 6c 6f |he param|eter blo|
|000044a0| 63 6b 20 61 6e 64 20 74 | 68 65 20 64 72 69 76 65 |ck and t|he drive|
|000044b0| 72 4f 70 65 6e 20 62 69 | 74 20 6f 66 20 74 68 65 |rOpen bi|t of the|
|000044c0| 20 64 43 74 6c 46 6c 61 | 67 73 20 66 69 65 6c 64 | dCtlFla|gs field|
|000044d0| 20 61 72 65 20 63 6c 65 | 61 72 65 64 2c 20 61 6e | are cle|ared, an|
|000044e0| 64 20 74 68 65 20 64 72 | 69 76 65 72 20 61 6e 64 |d the dr|iver and|
|000044f0| 20 69 74 73 20 44 43 45 | 20 61 72 65 20 75 6e 6c | its DCE| are unl|
|00004500| 6f 63 6b 65 64 2e 20 49 | 66 20 74 68 65 20 64 72 |ocked. I|f the dr|
|00004510| 69 76 65 72 20 72 65 74 | 75 72 6e 73 20 6e 6f 20 |iver ret|urns no |
|00004520| 65 72 72 6f 72 73 2c 20 | 74 68 65 6e 20 69 74 20 |errors, |then it |
|00004530| 61 6e 64 20 74 68 65 20 | 44 43 45 20 61 72 65 20 |and the |DCE are |
|00004540| 75 6e 6c 6f 63 6b 65 64 | 2c 20 69 66 20 61 6c 6c |unlocked|, if all|
|00004550| 6f 77 65 64 2e 20 49 6e | 20 65 69 74 68 65 72 20 |owed. In| either |
|00004560| 63 61 73 65 2c 20 74 68 | 65 20 72 65 73 75 6c 74 |case, th|e result|
|00004570| 20 66 72 6f 6d 20 74 68 | 65 20 64 72 69 76 65 72 | from th|e driver|
|00004580| 27 73 20 4f 70 65 6e 20 | 72 6f 75 74 69 6e 65 20 |'s Open |routine |
|00004590| 69 73 20 70 75 74 20 69 | 6e 20 74 68 65 20 69 6f |is put i|n the io|
|000045a0| 52 65 73 75 6c 74 20 66 | 69 65 6c 64 20 6f 66 20 |Result f|ield of |
|000045b0| 74 68 65 20 70 61 72 61 | 6d 65 74 65 72 20 62 6c |the para|meter bl|
|000045c0| 6f 63 6b 2e 0d 54 68 61 | 74 d5 73 20 47 72 65 61 |ock..Tha|t.s Grea|
|000045d0| 74 2c 20 42 75 74 20 57 | 68 61 74 20 41 72 65 20 |t, But W|hat Are |
|000045e0| 59 6f 75 20 44 72 69 76 | 69 6e 67 20 41 74 3f 0d |You Driv|ing At?.|
|000045f0| 53 6f 2c 20 6f 66 20 77 | 68 61 74 20 70 72 61 63 |So, of w|hat prac|
|00004600| 74 69 63 61 6c 20 76 61 | 6c 75 65 20 69 73 20 61 |tical va|lue is a|
|00004610| 6c 6c 20 74 68 69 73 3f | 20 20 49 66 20 79 6f 75 |ll this?| If you|
|00004620| 20 61 72 65 20 74 72 79 | 69 6e 67 20 74 6f 20 70 | are try|ing to p|
|00004630| 72 6f 76 69 64 65 20 61 | 20 6e 6f 6e 2d 73 6c 6f |rovide a| non-slo|
|00004640| 74 20 64 72 69 76 65 72 | 20 74 68 61 74 20 63 61 |t driver| that ca|
|00004650| 6e 20 62 65 20 69 6e 73 | 74 61 6c 6c 65 64 20 61 |n be ins|talled a|
|00004660| 74 20 49 4e 49 54 20 74 | 69 6d 65 20 61 6e 64 20 |t INIT t|ime and |
|00004670| 75 73 65 64 20 6c 61 74 | 65 72 20 62 79 20 6f 74 |used lat|er by ot|
|00004680| 68 65 72 20 73 6f 66 74 | 77 61 72 65 2c 20 74 68 |her soft|ware, th|
|00004690| 65 20 62 65 73 74 20 6d | 65 74 68 6f 64 20 66 6f |e best m|ethod fo|
|000046a0| 72 20 66 69 6e 64 69 6e | 67 20 61 20 75 6e 69 74 |r findin|g a unit|
|000046b0| 20 6e 75 6d 62 65 72 20 | 69 6e 20 74 68 65 20 75 | number |in the u|
|000046c0| 6e 69 74 20 74 61 62 6c | 65 20 69 73 20 74 68 65 |nit tabl|e is the|
|000046d0| 20 77 61 79 20 74 68 65 | 20 5f 4f 70 65 6e 20 74 | way the| _Open t|
|000046e0| 72 61 70 20 6f 6e 20 74 | 68 65 20 4d 61 63 69 6e |rap on t|he Macin|
|000046f0| 74 6f 73 68 20 49 49 20 | 66 61 6d 69 6c 79 20 66 |tosh II |family f|
|00004700| 69 6e 64 73 20 61 20 75 | 6e 69 74 20 6e 75 6d 62 |inds a u|nit numb|
|00004710| 65 72 20 69 6e 20 74 68 | 65 20 75 6e 69 74 20 74 |er in th|e unit t|
|00004720| 61 62 6c 65 20 66 6f 72 | 20 73 6c 6f 74 20 64 65 |able for| slot de|
|00004730| 76 69 63 65 20 64 72 69 | 76 65 72 73 2e 20 55 6e |vice dri|vers. Un|
|00004740| 66 6f 72 74 75 6e 61 74 | 65 6c 79 2c 20 79 6f 75 |fortunat|ely, you|
|00004750| 20 6d 61 79 20 77 61 6e | 74 20 74 6f 20 72 75 6e | may wan|t to run|
|00004760| 20 6f 6e 20 6f 74 68 65 | 72 20 4d 61 63 69 6e 74 | on othe|r Macint|
|00004770| 6f 73 68 20 6d 6f 64 65 | 6c 73 2c 20 61 6e 64 20 |osh mode|ls, and |
|00004780| 69 74 20 77 6f 75 6c 64 | 20 62 65 20 61 20 62 69 |it would| be a bi|
|00004790| 74 20 6b 6c 75 64 67 79 | 20 74 6f 20 66 61 6b 65 |t kludgy| to fake|
|000047a0| 20 62 65 69 6e 67 20 61 | 20 73 6c 6f 74 20 64 65 | being a| slot de|
|000047b0| 76 69 63 65 20 64 72 69 | 76 65 72 2c 20 73 6f 20 |vice dri|ver, so |
|000047c0| 79 6f 75 20 63 61 6e 6e | 6f 74 20 6a 75 73 74 20 |you cann|ot just |
|000047d0| 63 61 6c 6c 20 5f 4f 70 | 65 6e 20 61 6e 64 20 70 |call _Op|en and p|
|000047e0| 72 65 74 65 6e 64 20 74 | 6f 20 62 65 20 61 20 73 |retend t|o be a s|
|000047f0| 6c 6f 74 20 64 65 76 69 | 63 65 20 64 72 69 76 65 |lot devi|ce drive|
|00004800| 72 2e 20 41 64 64 69 74 | 69 6f 6e 61 6c 6c 79 2c |r. Addit|ionally,|
|00004810| 20 69 74 20 69 73 20 6c | 69 6b 65 6c 79 20 74 68 | it is l|ikely th|
|00004820| 61 74 20 79 6f 75 20 6d | 61 79 20 77 69 73 68 20 |at you m|ay wish |
|00004830| 74 68 61 74 20 74 68 65 | 20 64 72 69 76 65 72 d5 |that the| driver.|
|00004840| 73 20 4f 70 65 6e 20 72 | 6f 75 74 69 6e 65 20 6e |s Open r|outine n|
|00004850| 6f 74 20 62 65 20 63 61 | 6c 6c 65 64 20 75 6e 74 |ot be ca|lled unt|
|00004860| 69 6c 20 69 74 20 69 73 | 20 61 63 74 75 61 6c 6c |il it is| actuall|
|00004870| 79 20 6f 70 65 6e 65 64 | 20 77 69 74 68 20 74 68 |y opened| with th|
|00004880| 65 20 5f 4f 70 65 6e 20 | 74 72 61 70 20 62 79 20 |e _Open |trap by |
|00004890| 73 6f 66 74 77 61 72 65 | 20 74 68 61 74 20 72 65 |software| that re|
|000048a0| 61 6c 6c 79 20 77 61 6e | 74 73 20 74 6f 20 75 73 |ally wan|ts to us|
|000048b0| 65 20 69 74 3b 20 74 68 | 65 72 65 66 6f 72 65 2c |e it; th|erefore,|
|000048c0| 20 79 6f 75 72 20 49 4e | 49 54 20 63 6f 64 65 20 | your IN|IT code |
|000048d0| 6d 75 73 74 20 6d 69 6d | 69 63 20 74 68 65 20 70 |must mim|ic the p|
|000048e0| 65 72 74 69 6e 65 6e 74 | 20 63 6f 64 65 20 6f 66 |ertinent| code of|
|000048f0| 20 74 68 65 20 5f 4f 70 | 65 6e 20 74 72 61 70 2e | the _Op|en trap.|
|00004900| 0d 54 68 65 20 66 69 72 | 73 74 20 61 63 74 69 6f |.The fir|st actio|
|00004910| 6e 20 73 68 6f 75 6c 64 | 20 62 65 20 74 6f 20 63 |n should| be to c|
|00004920| 61 6c 6c 20 5f 47 65 74 | 4e 61 6d 65 64 52 65 73 |all _Get|NamedRes|
|00004930| 6f 75 72 63 65 20 77 69 | 74 68 20 74 68 65 20 6e |ource wi|th the n|
|00004940| 61 6d 65 20 6f 66 20 74 | 68 65 20 64 72 69 76 65 |ame of t|he drive|
|00004950| 72 20 61 6e 64 20 69 74 | 73 20 72 65 73 6f 75 72 |r and it|s resour|
|00004960| 63 65 20 74 79 70 65 20 | 28 74 79 70 69 63 61 6c |ce type |(typical|
|00004970| 6c 79 20 27 44 52 56 52 | 27 2c 20 61 6c 74 68 6f |ly 'DRVR|', altho|
|00004980| 75 67 68 20 69 74 20 69 | 73 20 6e 6f 74 20 72 65 |ugh it i|s not re|
|00004990| 71 75 69 72 65 64 2c 20 | 73 69 6e 63 65 20 79 6f |quired, |since yo|
|000049a0| 75 20 61 72 65 20 6c 6f | 61 64 69 6e 67 20 69 74 |u are lo|ading it|
|000049b0| 29 2e 20 54 68 65 20 72 | 65 73 6f 75 72 63 65 20 |). The r|esource |
|000049c0| 74 68 61 74 20 63 6f 6e | 74 61 69 6e 73 20 79 6f |that con|tains yo|
|000049d0| 75 72 20 64 72 69 76 65 | 72 20 6d 75 73 74 20 68 |ur drive|r must h|
|000049e0| 61 76 65 20 74 68 65 20 | 73 79 73 74 65 6d 20 68 |ave the |system h|
|000049f0| 65 61 70 20 62 69 74 20 | 73 65 74 20 69 6e 20 69 |eap bit |set in i|
|00004a00| 74 73 20 72 65 73 6f 75 | 72 63 65 20 61 74 74 72 |ts resou|rce attr|
|00004a10| 69 62 75 74 65 73 2c 20 | 73 6f 20 69 74 20 69 73 |ibutes, |so it is|
|00004a20| 20 6c 6f 61 64 65 64 20 | 69 6e 74 6f 20 74 68 65 | loaded |into the|
|00004a30| 20 73 79 73 74 65 6d 20 | 68 65 61 70 20 77 68 65 | system |heap whe|
|00004a40| 72 65 20 69 74 20 63 61 | 6e 20 63 6f 6e 74 69 6e |re it ca|n contin|
|00004a50| 75 65 20 74 6f 20 65 78 | 69 73 74 2c 20 6c 6f 6e |ue to ex|ist, lon|
|00004a60| 67 20 61 66 74 65 72 20 | 74 68 65 20 49 4e 49 54 |g after |the INIT|
|00004a70| 20 68 61 73 20 67 6f 6e | 65 20 61 77 61 79 2e 20 | has gon|e away. |
|00004a80| 4e 6f 74 65 20 74 68 61 | 74 20 69 66 20 66 6f 72 |Note tha|t if for|
|00004a90| 20 73 6f 6d 65 20 69 6e | 63 72 65 64 69 62 6c 65 | some in|credible|
|00004aa0| 20 72 65 61 73 6f 6e 2c | 20 79 6f 75 72 20 64 72 | reason,| your dr|
|00004ab0| 69 76 65 72 20 69 73 20 | 67 72 65 61 74 65 72 20 |iver is |greater |
|00004ac0| 74 68 61 6e 20 31 36 4b | 2c 20 79 6f 75 20 6d 69 |than 16K|, you mi|
|00004ad0| 67 68 74 20 77 61 6e 74 | 20 74 6f 20 69 6e 63 6c |ght want| to incl|
|00004ae0| 75 64 65 20 61 20 27 73 | 79 73 7a 27 20 72 65 73 |ude a 's|ysz' res|
|00004af0| 6f 75 72 63 65 20 74 6f | 20 69 6e 63 72 65 61 73 |ource to| increas|
|00004b00| 65 20 74 68 65 20 61 76 | 61 69 6c 61 62 6c 65 20 |e the av|ailable |
|00004b10| 73 70 61 63 65 20 69 6e | 20 74 68 65 20 73 79 73 |space in| the sys|
|00004b20| 74 65 6d 20 68 65 61 70 | 2e 0d 4e 65 78 74 2c 20 |tem heap|..Next, |
|00004b30| 79 6f 75 20 6d 75 73 74 | 20 63 61 6c 6c 20 5f 44 |you must| call _D|
|00004b40| 65 74 61 63 68 52 65 73 | 6f 75 72 63 65 20 77 69 |etachRes|ource wi|
|00004b50| 74 68 20 74 68 65 20 68 | 61 6e 64 6c 65 20 74 6f |th the h|andle to|
|00004b60| 20 79 6f 75 72 20 72 65 | 73 6f 75 72 63 65 2c 20 | your re|source, |
|00004b70| 73 6f 20 69 74 20 69 73 | 20 6e 6f 74 20 72 65 6d |so it is| not rem|
|00004b80| 6f 76 65 64 20 77 68 65 | 6e 20 79 6f 75 72 20 49 |oved whe|n your I|
|00004b90| 4e 49 54 20 66 69 6c 65 | 20 69 73 20 63 6c 6f 73 |NIT file| is clos|
|00004ba0| 65 64 2e 20 4e 6f 77 20 | 79 6f 75 20 61 72 65 20 |ed. Now |you are |
|00004bb0| 72 65 61 64 79 20 74 6f | 20 66 69 6e 64 20 61 20 |ready to| find a |
|00004bc0| 73 6c 6f 74 20 69 6e 20 | 74 68 65 20 75 6e 69 74 |slot in |the unit|
|00004bd0| 20 74 61 62 6c 65 20 66 | 6f 72 20 79 6f 75 72 20 | table f|or your |
|00004be0| 64 72 69 76 65 72 2e 20 | 46 69 72 73 74 20 63 68 |driver. |First ch|
|00004bf0| 65 63 6b 20 69 66 20 75 | 6e 69 74 20 6e 75 6d 62 |eck if u|nit numb|
|00004c00| 65 72 73 20 34 38 20 61 | 6e 64 20 68 69 67 68 65 |ers 48 a|nd highe|
|00004c10| 72 20 61 72 65 20 65 76 | 65 6e 20 61 76 61 69 6c |r are ev|en avail|
|00004c20| 61 62 6c 65 20 62 79 20 | 63 68 65 63 6b 69 6e 67 |able by |checking|
|00004c30| 20 55 6e 69 74 4e 74 72 | 79 43 6e 74 2e 0d 49 66 | UnitNtr|yCnt..If|
|00004c40| 20 55 6e 69 74 4e 74 72 | 79 43 6e 74 20 69 73 20 | UnitNtr|yCnt is |
|00004c50| 34 38 2c 20 79 6f 75 20 | 68 61 76 65 20 61 20 62 |48, you |have a b|
|00004c60| 69 74 20 6f 66 20 61 20 | 70 72 6f 62 6c 65 6d 20 |it of a |problem |
|00004c70| 69 6e 20 74 68 61 74 20 | 74 68 65 72 65 20 61 72 |in that |there ar|
|00004c80| 65 20 6e 6f 20 65 6d 70 | 74 79 20 73 6c 6f 74 73 |e no emp|ty slots|
|00004c90| 20 61 76 61 69 6c 61 62 | 6c 65 20 69 6e 20 74 68 | availab|le in th|
|00004ca0| 65 20 75 6e 69 74 20 74 | 61 62 6c 65 2e 20 59 6f |e unit t|able. Yo|
|00004cb0| 75 20 63 61 6e 20 72 65 | 63 74 69 66 79 20 74 68 |u can re|ctify th|
|00004cc0| 69 73 2c 20 68 6f 77 65 | 76 65 72 2c 20 62 79 20 |is, howe|ver, by |
|00004cd0| 72 65 73 69 7a 69 6e 67 | 20 74 68 65 20 75 6e 69 |resizing| the uni|
|00004ce0| 74 20 74 61 62 6c 65 2e | 20 44 54 53 20 72 65 63 |t table.| DTS rec|
|00004cf0| 6f 6d 6d 65 6e 64 73 20 | 79 6f 75 20 61 63 63 6f |ommends |you acco|
|00004d00| 6d 70 6c 69 73 68 20 74 | 68 61 74 20 74 61 73 6b |mplish t|hat task|
|00004d10| 20 62 79 20 63 72 65 61 | 74 69 6e 67 20 61 20 6e | by crea|ting a n|
|00004d20| 65 77 20 75 6e 69 74 20 | 74 61 62 6c 65 20 74 68 |ew unit |table th|
|00004d30| 61 74 20 69 73 20 6c 61 | 72 67 65 72 20 74 68 61 |at is la|rger tha|
|00004d40| 6e 20 74 68 65 20 6f 6c | 64 20 6f 6e 65 2e 0d 54 |n the ol|d one..T|
|00004d50| 6f 20 72 65 73 69 7a 65 | 20 74 68 65 20 75 6e 69 |o resize| the uni|
|00004d60| 74 20 74 61 62 6c 65 2c | 20 66 69 72 73 74 20 63 |t table,| first c|
|00004d70| 72 65 61 74 65 20 61 20 | 6e 65 77 2c 20 6e 6f 6e |reate a |new, non|
|00004d80| 2d 72 65 6c 6f 63 61 74 | 61 62 6c 65 20 62 6c 6f |-relocat|able blo|
|00004d90| 63 6b 20 69 6e 20 74 68 | 65 20 73 79 73 74 65 6d |ck in th|e system|
|00004da0| 20 68 65 61 70 20 74 68 | 61 74 20 69 73 20 74 68 | heap th|at is th|
|00004db0| 65 20 6e 65 77 20 73 69 | 7a 65 20 79 6f 75 20 77 |e new si|ze you w|
|00004dc0| 61 6e 74 2c 20 61 6e 64 | 20 63 6c 65 61 72 20 69 |ant, and| clear i|
|00004dd0| 74 20 74 6f 20 7a 65 72 | 6f 73 2e 20 54 68 65 20 |t to zer|os. The |
|00004de0| 66 6f 6c 6c 6f 77 69 6e | 67 20 61 73 73 65 6d 62 |followin|g assemb|
|00004df0| 6c 79 2d 6c 61 6e 67 75 | 61 67 65 20 63 6f 64 65 |ly-langu|age code|
|00004e00| 20 66 72 61 67 6d 65 6e | 74 20 67 69 76 65 73 20 | fragmen|t gives |
|00004e10| 61 6e 20 65 78 61 6d 70 | 6c 65 3a 0d 20 20 20 20 |an examp|le:. |
|00004e20| 4d 4f 56 45 2e 57 20 20 | 20 20 20 44 31 2c 44 30 |MOVE.W | D1,D0|
|00004e30| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004e40| 20 20 20 20 3b 44 31 20 | 3d 20 72 65 71 75 65 73 | ;D1 |= reques|
|00004e50| 74 65 64 20 23 20 73 6c | 6f 74 73 0d 20 20 20 20 |ted # sl|ots. |
|00004e60| 4d 55 4c 55 2e 57 20 20 | 20 20 20 23 34 2c 44 30 |MULU.W | #4,D0|
|00004e70| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004e80| 20 20 20 20 3b 74 75 72 | 6e 20 69 74 20 69 6e 74 | ;tur|n it int|
|00004e90| 6f 20 73 69 7a 65 0d 20 | 20 20 20 5f 4e 65 77 50 |o size. | _NewP|
|00004ea0| 74 72 2c 53 59 53 2c 43 | 4c 45 41 52 20 20 20 20 |tr,SYS,C|LEAR |
|00004eb0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 3b | | ;|
|00004ec0| 63 72 65 61 74 65 20 63 | 6c 65 61 72 20 62 6c 6f |create c|lear blo|
|00004ed0| 63 6b 20 69 6e 20 73 79 | 73 74 65 6d 20 68 65 61 |ck in sy|stem hea|
|00004ee0| 70 0d 20 20 20 20 42 4e | 45 20 20 20 20 20 20 20 |p. BN|E |
|00004ef0| 20 45 72 72 6f 72 20 20 | 20 20 20 20 20 20 20 20 | Error | |
|00004f00| 20 20 20 20 20 20 20 20 | 20 20 3b 63 68 65 63 6b | | ;check|
|00004f10| 20 66 6f 72 20 65 72 72 | 6f 72 73 21 0d 4e 65 78 | for err|ors!.Nex|
|00004f20| 74 2c 20 79 6f 75 20 6d | 75 73 74 20 63 6f 70 79 |t, you m|ust copy|
|00004f30| 20 74 68 65 20 63 6f 6e | 74 65 6e 74 73 20 6f 66 | the con|tents of|
|00004f40| 20 74 68 65 20 6f 6c 64 | 20 75 6e 69 74 20 74 61 | the old| unit ta|
|00004f50| 62 6c 65 20 69 6e 74 6f | 20 74 68 65 20 6e 65 77 |ble into| the new|
|00004f60| 20 75 6e 69 74 20 74 61 | 62 6c 65 2c 20 70 6f 69 | unit ta|ble, poi|
|00004f70| 6e 74 20 55 54 61 62 6c | 65 42 61 73 65 20 74 6f |nt UTabl|eBase to|
|00004f80| 20 74 68 65 20 6e 65 77 | 20 75 6e 69 74 20 74 61 | the new| unit ta|
|00004f90| 62 6c 65 2c 20 61 6e 64 | 20 61 64 6a 75 73 74 20 |ble, and| adjust |
|00004fa0| 74 68 65 20 76 61 6c 75 | 65 20 6f 66 20 55 6e 69 |the valu|e of Uni|
|00004fb0| 74 4e 74 72 79 43 6e 74 | 2e 20 57 68 69 6c 65 20 |tNtryCnt|. While |
|00004fc0| 64 6f 69 6e 67 20 61 6c | 6c 20 6f 66 20 74 68 61 |doing al|l of tha|
|00004fd0| 74 2c 20 69 74 20 77 6f | 75 6c 64 20 62 65 20 6d |t, it wo|uld be m|
|00004fe0| 6f 73 74 20 69 6e 63 6f | 6e 76 65 6e 69 65 6e 74 |ost inco|nvenient|
|00004ff0| 20 69 66 20 61 6e 20 69 | 6e 74 65 72 72 75 70 74 | if an i|nterrupt|
|00005000| 20 6f 63 63 75 72 72 65 | 64 3b 20 74 68 65 72 65 | occurre|d; there|
|00005010| 66 6f 72 65 2c 20 79 6f | 75 20 6d 75 73 74 20 74 |fore, yo|u must t|
|00005020| 75 72 6e 20 6f 66 66 20 | 69 6e 74 65 72 72 75 70 |urn off |interrup|
|00005030| 74 73 20 64 75 72 69 6e | 67 20 74 68 65 20 70 72 |ts durin|g the pr|
|00005040| 6f 63 65 73 73 2e 20 54 | 68 65 20 66 6f 6c 6c 6f |ocess. T|he follo|
|00005050| 77 69 6e 67 20 61 73 73 | 65 6d 62 6c 79 2d 6c 61 |wing ass|embly-la|
|00005060| 6e 67 75 61 67 65 20 63 | 6f 64 65 20 66 72 61 67 |nguage c|ode frag|
|00005070| 6d 65 6e 74 2c 20 77 68 | 69 63 68 20 77 6f 75 6c |ment, wh|ich woul|
|00005080| 64 20 66 6f 6c 6c 6f 77 | 20 74 68 65 20 70 72 65 |d follow| the pre|
|00005090| 76 69 6f 75 73 20 63 6f | 64 65 2c 20 67 69 76 65 |vious co|de, give|
|000050a0| 73 20 61 6e 20 65 78 61 | 6d 70 6c 65 3a 0d 20 20 |s an exa|mple:. |
|000050b0| 20 20 4d 4f 56 45 20 20 | 20 20 20 20 20 53 52 2c | MOVE | SR,|
|000050c0| 2d 28 53 50 29 20 20 20 | 20 20 20 20 20 20 20 20 |-(SP) | |
|000050d0| 20 20 20 20 20 20 3b 73 | 61 76 65 20 6f 6c 64 20 | ;s|ave old |
|000050e0| 69 6e 74 65 72 72 75 70 | 74 20 73 74 61 74 75 73 |interrup|t status|
|000050f0| 0d 20 20 20 20 4f 52 09 | 20 20 20 20 20 20 20 23 |. OR.| #|
|00005100| 30 37 30 30 2c 53 52 09 | 20 20 20 20 20 20 20 20 |0700,SR.| |
|00005110| 20 20 20 3b 64 69 73 61 | 62 6c 65 20 61 6c 6c 20 | ;disa|ble all |
|00005120| 6d 61 73 6b 61 62 6c 65 | 20 69 6e 74 65 72 72 75 |maskable| interru|
|00005130| 70 74 73 0d 20 20 20 20 | 4d 4f 56 45 41 2e 4c 20 |pts. |MOVEA.L |
|00005140| 20 20 20 41 30 2c 41 31 | 20 20 20 20 20 20 20 20 | A0,A1| |
|00005150| 20 20 20 20 20 20 20 20 | 20 20 20 20 3b 41 30 20 | | ;A0 |
|00005160| 28 61 64 64 72 65 73 73 | 20 6e 65 77 20 75 6e 69 |(address| new uni|
|00005170| 74 20 74 61 62 6c 65 29 | 20 2d 3e 20 41 31 0d 20 |t table)| -> A1. |
|00005180| 20 20 20 4d 4f 56 45 41 | 2e 4c 20 20 20 20 55 54 | MOVEA|.L UT|
|00005190| 61 62 6c 65 42 61 73 65 | 2c 41 30 20 20 20 20 20 |ableBase|,A0 |
|000051a0| 20 20 20 20 20 20 20 3b | 6f 6c 64 20 75 6e 69 74 | ;|old unit|
|000051b0| 20 74 61 62 6c 65 20 2d | 3e 20 41 30 0d 20 20 20 | table -|> A0. |
|000051c0| 20 4d 4f 56 45 2e 57 20 | 20 20 20 20 55 6e 69 74 | MOVE.W | Unit|
|000051d0| 4e 74 72 79 43 6e 74 2c | 44 30 20 20 20 20 20 20 |NtryCnt,|D0 |
|000051e0| 20 20 20 20 20 3b 6e 75 | 6d 62 65 72 20 6f 66 20 | ;nu|mber of |
|000051f0| 65 6e 74 72 69 65 73 20 | 2d 3e 20 44 30 0d 20 20 |entries |-> D0. |
|00005200| 20 20 4d 55 4c 55 2e 57 | 20 20 20 20 20 23 34 2c | MULU.W| #4,|
|00005210| 44 30 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |D0 | |
|00005220| 20 20 20 20 20 20 3b 73 | 69 7a 65 20 6f 66 20 6f | ;s|ize of o|
|00005230| 6c 64 20 74 61 62 6c 65 | 20 2d 3e 20 44 30 0d 20 |ld table| -> D0. |
|00005240| 20 20 20 5f 42 6c 6f 63 | 6b 4d 6f 76 65 20 20 20 | _Bloc|kMove |
|00005250| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005260| 20 20 20 20 20 20 20 3b | 63 6f 70 79 20 6f 6c 64 | ;|copy old|
|00005270| 20 74 61 62 6c 65 20 74 | 6f 20 6e 65 77 20 74 61 | table t|o new ta|
|00005280| 62 6c 65 0d 20 20 20 20 | 5f 44 69 73 70 6f 73 50 |ble. |_DisposP|
|00005290| 74 72 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |tr | |
|000052a0| 20 20 20 20 20 20 20 20 | 20 20 20 20 3b 67 65 74 | | ;get|
|000052b0| 20 72 69 64 20 6f 66 20 | 6f 6c 64 20 74 61 62 6c | rid of |old tabl|
|000052c0| 65 0d 20 20 20 20 4d 4f | 56 45 2e 4c 20 20 20 20 |e. MO|VE.L |
|000052d0| 20 41 31 2c 55 54 61 62 | 6c 65 42 61 73 65 20 20 | A1,UTab|leBase |
|000052e0| 20 20 20 20 20 20 20 20 | 20 20 3b 6d 61 6b 65 20 | | ;make |
|000052f0| 75 73 20 6e 65 77 20 75 | 6e 69 74 20 74 61 62 6c |us new u|nit tabl|
|00005300| 65 0d 20 20 20 20 4d 4f | 56 45 2e 57 20 20 20 20 |e. MO|VE.W |
|00005310| 20 44 31 2c 55 6e 69 74 | 4e 74 72 79 43 6e 74 20 | D1,Unit|NtryCnt |
|00005320| 20 20 20 20 20 20 20 20 | 20 20 3b 75 70 64 61 74 | | ;updat|
|00005330| 65 20 6e 75 6d 62 65 72 | 20 6f 66 20 65 6e 74 72 |e number| of entr|
|00005340| 69 65 73 0d 20 20 20 20 | 4d 4f 56 45 20 20 20 20 |ies. |MOVE |
|00005350| 20 20 20 28 53 50 29 2b | 2c 53 52 20 20 20 20 20 | (SP)+|,SR |
|00005360| 20 20 20 20 20 20 20 20 | 20 20 20 20 3b 72 65 73 | | ;res|
|00005370| 74 6f 72 65 20 6f 6c 64 | 20 69 6e 74 65 72 72 75 |tore old| interru|
|00005380| 70 74 20 73 74 61 74 75 | 73 0d 44 54 53 20 73 75 |pt statu|s.DTS su|
|00005390| 67 67 65 73 74 73 20 74 | 68 61 74 20 69 66 20 55 |ggests t|hat if U|
|000053a0| 6e 69 74 4e 74 72 79 43 | 6e 74 20 77 61 73 20 6f |nitNtryC|nt was o|
|000053b0| 72 69 67 69 6e 61 6c 6c | 79 20 34 38 2c 20 79 6f |riginall|y 48, yo|
|000053c0| 75 20 69 6e 63 72 65 61 | 73 65 20 69 74 20 74 6f |u increa|se it to|
|000053d0| 20 36 34 2c 20 61 64 6a | 75 73 74 69 6e 67 20 74 | 64, adj|usting t|
|000053e0| 68 65 20 74 61 62 6c 65 | 20 73 69 7a 65 20 61 73 |he table| size as|
|000053f0| 20 73 68 6f 77 6e 2e 0d | 41 74 20 74 68 69 73 20 | shown..|At this |
|00005400| 70 6f 69 6e 74 2c 20 77 | 69 74 68 20 74 68 65 20 |point, w|ith the |
|00005410| 75 6e 69 74 20 74 61 62 | 6c 65 20 72 65 73 69 7a |unit tab|le resiz|
|00005420| 65 64 20 6f 72 20 61 6c | 72 65 61 64 79 20 61 74 |ed or al|ready at|
|00005430| 20 61 20 73 69 7a 65 20 | 74 6f 20 68 6f 6c 64 20 | a size |to hold |
|00005440| 6d 6f 72 65 20 74 68 61 | 6e 20 34 38 20 75 6e 69 |more tha|n 48 uni|
|00005450| 74 20 6e 75 6d 62 65 72 | 73 2c 20 69 74 20 6d 61 |t number|s, it ma|
|00005460| 79 20 62 65 20 73 65 61 | 72 63 68 65 64 20 66 6f |y be sea|rched fo|
|00005470| 72 20 61 6e 20 65 6d 70 | 74 79 20 73 6c 6f 74 2c |r an emp|ty slot,|
|00005480| 20 73 74 61 72 74 69 6e | 67 20 61 74 20 75 6e 69 | startin|g at uni|
|00005490| 74 20 6e 75 6d 62 65 72 | 20 34 38 20 61 6e 64 20 |t number| 48 and |
|000054a0| 65 6e 64 69 6e 67 20 61 | 74 20 55 6e 69 74 4e 74 |ending a|t UnitNt|
|000054b0| 72 79 43 6e 74 2e 20 49 | 66 2c 20 69 6e 20 74 68 |ryCnt. I|f, in th|
|000054c0| 65 20 63 61 73 65 20 77 | 68 65 72 65 20 74 68 65 |e case w|here the|
|000054d0| 20 75 6e 69 74 20 74 61 | 62 6c 65 20 61 6c 72 65 | unit ta|ble alre|
|000054e0| 61 64 79 20 68 65 6c 64 | 20 6d 6f 72 65 20 74 68 |ady held| more th|
|000054f0| 61 6e 20 34 38 20 75 6e | 69 74 20 6e 75 6d 62 65 |an 48 un|it numbe|
|00005500| 72 73 2c 20 6e 6f 20 65 | 6d 70 74 79 20 73 6c 6f |rs, no e|mpty slo|
|00005510| 74 20 77 61 73 20 66 6f | 75 6e 64 2c 20 74 68 65 |t was fo|und, the|
|00005520| 6e 20 74 68 65 20 75 6e | 69 74 20 74 61 62 6c 65 |n the un|it table|
|00005530| 20 6d 69 67 68 74 20 62 | 65 20 61 62 6c 65 20 74 | might b|e able t|
|00005540| 6f 20 62 65 20 65 78 70 | 61 6e 64 65 64 20 61 73 |o be exp|anded as|
|00005550| 20 77 61 73 20 64 65 73 | 63 72 69 62 65 64 20 70 | was des|cribed p|
|00005560| 72 65 76 69 6f 75 73 6c | 79 2e 20 54 68 69 73 20 |reviousl|y. This |
|00005570| 74 69 6d 65 2c 20 68 6f | 77 65 76 65 72 2c 20 74 |time, ho|wever, t|
|00005580| 68 65 20 70 72 6f 63 65 | 73 73 20 63 61 6e 20 62 |he proce|ss can b|
|00005590| 65 20 61 20 62 69 74 20 | 6d 6f 72 65 20 63 6f 6d |e a bit |more com|
|000055a0| 70 6c 69 63 61 74 65 64 | 2e 0d 49 74 20 63 6f 75 |plicated|..It cou|
|000055b0| 6c 64 20 76 65 72 79 20 | 77 65 6c 6c 20 62 65 20 |ld very |well be |
|000055c0| 74 68 61 74 20 74 68 65 | 20 75 6e 69 74 20 74 61 |that the| unit ta|
|000055d0| 62 6c 65 20 69 74 73 65 | 6c 66 20 69 73 20 61 6c |ble itse|lf is al|
|000055e0| 72 65 61 64 79 20 6c 61 | 72 67 65 72 20 74 68 61 |ready la|rger tha|
|000055f0| 6e 20 77 68 61 74 20 55 | 6e 69 74 4e 74 72 79 43 |n what U|nitNtryC|
|00005600| 6e 74 20 77 6f 75 6c 64 | 20 69 6e 64 69 63 61 74 |nt would| indicat|
|00005610| 65 2c 20 65 69 74 68 65 | 72 20 62 65 63 61 75 73 |e, eithe|r becaus|
|00005620| 65 20 74 68 65 20 6d 61 | 63 68 69 6e 65 20 69 73 |e the ma|chine is|
|00005630| 20 61 20 4d 61 63 69 6e | 74 6f 73 68 20 49 49 2d | a Macin|tosh II-|
|00005640| 63 6c 61 73 73 20 6d 61 | 63 68 69 6e 65 20 6f 72 |class ma|chine or|
|00005650| 20 73 6f 6d 65 62 6f 64 | 79 20 65 6c 73 65 20 68 | somebod|y else h|
|00005660| 61 73 20 63 68 61 6e 67 | 65 64 20 74 68 69 6e 67 |as chang|ed thing|
|00005670| 73 20 61 68 65 61 64 20 | 6f 66 20 79 6f 75 72 20 |s ahead |of your |
|00005680| 49 4e 49 54 2e 20 54 68 | 65 20 62 65 73 74 20 61 |INIT. Th|e best a|
|00005690| 63 74 69 6f 6e 20 74 6f | 20 74 61 6b 65 20 77 6f |ction to| take wo|
|000056a0| 75 6c 64 20 62 65 20 74 | 6f 20 63 61 6c 6c 20 5f |uld be t|o call _|
|000056b0| 47 65 74 50 74 72 53 69 | 7a 65 20 6f 6e 20 74 68 |GetPtrSi|ze on th|
|000056c0| 65 20 75 6e 69 74 20 74 | 61 62 6c 65 2c 20 64 69 |e unit t|able, di|
|000056d0| 76 69 64 65 20 74 68 65 | 20 72 65 73 75 6c 74 20 |vide the| result |
|000056e0| 62 79 20 66 6f 75 72 2c | 20 72 6f 75 6e 64 69 6e |by four,| roundin|
|000056f0| 67 20 64 6f 77 6e 2c 20 | 61 6e 64 20 63 6f 6d 70 |g down, |and comp|
|00005700| 61 72 65 20 74 68 61 74 | 20 6e 75 6d 62 65 72 20 |are that| number |
|00005710| 74 6f 20 55 6e 69 74 4e | 74 72 79 43 6e 74 2e 20 |to UnitN|tryCnt. |
|00005720| 49 66 20 55 6e 69 74 4e | 74 72 79 43 6e 74 20 69 |If UnitN|tryCnt i|
|00005730| 73 20 6c 6f 77 65 72 20 | 74 68 61 6e 20 74 68 61 |s lower |than tha|
|00005740| 74 20 72 65 73 75 6c 74 | 2c 20 79 6f 75 20 63 61 |t result|, you ca|
|00005750| 6e 20 69 6e 63 72 65 6d | 65 6e 74 20 55 6e 69 74 |n increm|ent Unit|
|00005760| 4e 74 72 79 43 6e 74 20 | 62 79 20 61 6e 79 20 61 |NtryCnt |by any a|
|00005770| 6d 6f 75 6e 74 20 74 68 | 61 74 20 6b 65 65 70 73 |mount th|at keeps|
|00005780| 20 69 74 20 6c 65 73 73 | 20 74 68 61 6e 20 6f 72 | it less| than or|
|00005790| 20 65 71 75 61 6c 20 74 | 6f 20 74 68 65 20 6d 61 | equal t|o the ma|
|000057a0| 78 69 6d 75 6d 20 61 6c | 6c 6f 77 61 62 6c 65 20 |ximum al|lowable |
|000057b0| 73 69 7a 65 20 74 68 61 | 74 20 74 68 65 20 75 6e |size tha|t the un|
|000057c0| 69 74 20 74 61 62 6c 65 | 20 63 61 6e 20 68 61 6e |it table| can han|
|000057d0| 64 6c 65 2e 20 46 6f 75 | 72 20 69 73 20 61 20 67 |dle. Fou|r is a g|
|000057e0| 6f 6f 64 20 6e 75 6d 62 | 65 72 2c 20 62 65 63 61 |ood numb|er, beca|
|000057f0| 75 73 65 20 69 74 20 72 | 65 64 75 63 65 73 20 74 |use it r|educes t|
|00005800| 68 65 20 6e 65 65 64 20 | 66 6f 72 20 73 6f 6d 65 |he need |for some|
|00005810| 6f 6e 65 20 65 6c 73 65 | 20 74 6f 20 64 6f 20 74 |one else| to do t|
|00005820| 68 65 20 73 61 6d 65 20 | 63 68 65 63 6b 20 6c 61 |he same |check la|
|00005830| 74 65 72 20 6f 6e 20 77 | 69 74 68 6f 75 74 20 61 |ter on w|ithout a|
|00005840| 6c 73 6f 20 6d 61 6b 69 | 6e 67 20 74 68 65 20 73 |lso maki|ng the s|
|00005850| 65 61 72 63 68 20 66 6f | 72 20 61 20 67 69 76 65 |earch fo|r a give|
|00005860| 6e 20 64 72 69 76 65 72 | 2e 20 4f 6e 63 65 20 55 |n driver|. Once U|
|00005870| 6e 69 74 4e 74 72 79 43 | 6e 74 20 68 61 73 20 62 |nitNtryC|nt has b|
|00005880| 65 65 6e 20 69 6e 63 72 | 65 6d 65 6e 74 65 64 2c |een incr|emented,|
|00005890| 20 79 6f 75 20 6b 6e 6f | 77 20 79 6f 75 20 68 61 | you kno|w you ha|
|000058a0| 76 65 20 61 6e 20 65 6d | 70 74 79 20 73 6c 6f 74 |ve an em|pty slot|
|000058b0| 20 77 61 69 74 69 6e 67 | 2e 0d 49 66 20 55 6e 69 | waiting|..If Uni|
|000058c0| 74 4e 74 72 79 43 6e 74 | 20 69 73 20 61 6c 72 65 |tNtryCnt| is alre|
|000058d0| 61 64 79 20 65 71 75 61 | 6c 20 74 6f 20 74 68 65 |ady equa|l to the|
|000058e0| 20 73 69 7a 65 20 6f 66 | 20 74 68 65 20 75 6e 69 | size of| the uni|
|000058f0| 74 20 74 61 62 6c 65 20 | 64 69 76 69 64 65 64 20 |t table |divided |
|00005900| 62 79 20 66 6f 75 72 2c | 20 79 6f 75 20 73 68 6f |by four,| you sho|
|00005910| 75 6c 64 20 65 78 70 61 | 6e 64 20 74 68 65 20 75 |uld expa|nd the u|
|00005920| 6e 69 74 20 74 61 62 6c | 65 20 61 73 20 64 65 73 |nit tabl|e as des|
|00005930| 63 72 69 62 65 64 20 70 | 72 65 76 69 6f 75 73 6c |cribed p|reviousl|
|00005940| 79 2c 20 63 68 6f 6f 73 | 69 6e 67 20 61 20 73 69 |y, choos|ing a si|
|00005950| 7a 65 20 61 72 6f 75 6e | 64 20 31 36 20 6f 72 20 |ze aroun|d 16 or |
|00005960| 33 32 20 62 79 74 65 73 | 20 67 72 65 61 74 65 72 |32 bytes| greater|
|00005970| 20 74 68 61 6e 20 74 68 | 65 20 6f 6c 64 20 73 69 | than th|e old si|
|00005980| 7a 65 2e 20 52 65 6d 65 | 6d 62 65 72 20 74 6f 20 |ze. Reme|mber to |
|00005990| 61 6c 77 61 79 73 20 63 | 68 65 63 6b 20 74 68 65 |always c|heck the|
|000059a0| 20 72 65 73 75 6c 74 20 | 6f 66 20 74 68 65 20 5f | result |of the _|
|000059b0| 4e 65 77 50 74 72 20 63 | 61 6c 6c 3b 20 69 74 20 |NewPtr c|all; it |
|000059c0| 77 6f 75 6c 64 20 62 65 | 20 63 61 74 61 73 74 72 |would be| catastr|
|000059d0| 6f 70 68 69 63 20 74 6f | 20 63 6f 70 79 20 74 68 |ophic to| copy th|
|000059e0| 65 20 6f 6c 64 20 75 6e | 69 74 20 74 61 62 6c 65 |e old un|it table|
|000059f0| 20 69 6e 74 6f 20 74 68 | 65 20 6c 6f 77 2d 6d 65 | into th|e low-me|
|00005a00| 6d 6f 72 79 20 67 6c 6f | 62 61 6c 20 61 72 65 61 |mory glo|bal area|
|00005a10| 2e 0d 4f 6e 63 65 20 79 | 6f 75 20 68 61 76 65 20 |..Once y|ou have |
|00005a20| 66 6f 75 6e 64 20 61 20 | 73 6c 6f 74 20 66 6f 72 |found a |slot for|
|00005a30| 20 74 68 65 20 64 72 69 | 76 65 72 20 69 6e 20 74 | the dri|ver in t|
|00005a40| 68 65 20 75 6e 69 74 20 | 74 61 62 6c 65 2c 20 63 |he unit |table, c|
|00005a50| 61 6c 6c 20 5f 44 72 69 | 76 65 72 49 6e 73 74 61 |all _Dri|verInsta|
|00005a60| 6c 6c 20 77 69 74 68 20 | 74 68 65 20 63 6f 72 72 |ll with |the corr|
|00005a70| 65 73 70 6f 6e 64 69 6e | 67 20 72 65 66 6e 75 6d |espondin|g refnum|
|00005a80| 20 61 6e 64 20 70 6f 69 | 6e 74 65 72 20 74 6f 20 | and poi|nter to |
|00005a90| 74 68 65 20 64 72 69 76 | 65 72 2e 20 54 68 69 73 |the driv|er. This|
|00005aa0| 20 63 61 6c 6c 20 63 72 | 65 61 74 65 73 20 61 20 | call cr|eates a |
|00005ab0| 44 43 45 20 66 6f 72 20 | 74 68 65 20 64 72 69 76 |DCE for |the driv|
|00005ac0| 65 72 20 61 6e 64 20 73 | 65 74 73 20 75 70 20 74 |er and s|ets up t|
|00005ad0| 68 65 20 63 6f 72 72 65 | 63 74 20 72 65 66 6e 75 |he corre|ct refnu|
|00005ae0| 6d 20 69 6e 20 74 68 65 | 20 44 43 45 2e 20 4e 65 |m in the| DCE. Ne|
|00005af0| 78 74 2c 20 6d 6f 76 65 | 20 74 68 65 20 68 61 6e |xt, move| the han|
|00005b00| 64 6c 65 20 74 6f 20 74 | 68 65 20 64 72 69 76 65 |dle to t|he drive|
|00005b10| 72 20 69 6e 74 6f 20 74 | 68 65 20 64 43 74 6c 44 |r into t|he dCtlD|
|00005b20| 72 69 76 65 72 20 66 69 | 65 6c 64 20 6f 66 20 74 |river fi|eld of t|
|00005b30| 68 65 20 44 43 45 2c 20 | 74 68 65 6e 20 6d 6f 76 |he DCE, |then mov|
|00005b40| 65 20 74 68 65 20 44 72 | 76 72 46 6c 61 67 73 2c |e the Dr|vrFlags,|
|00005b50| 20 44 72 76 72 44 65 6c | 61 79 2c 20 44 72 76 72 | DrvrDel|ay, Drvr|
|00005b60| 45 4d 61 73 6b 2c 20 61 | 6e 64 20 44 72 76 72 4d |EMask, a|nd DrvrM|
|00005b70| 65 6e 75 20 66 69 65 6c | 64 73 20 6f 66 20 74 68 |enu fiel|ds of th|
|00005b80| 65 20 64 72 69 76 65 72 | 20 68 65 61 64 65 72 20 |e driver| header |
|00005b90| 69 6e 74 6f 20 74 68 65 | 20 64 43 74 6c 46 6c 61 |into the| dCtlFla|
|00005ba0| 67 73 2c 20 64 43 74 6c | 44 65 6c 61 79 2c 20 64 |gs, dCtl|Delay, d|
|00005bb0| 43 74 6c 45 4d 61 73 6b | 2c 20 61 6e 64 20 64 43 |CtlEMask|, and dC|
|00005bc0| 74 6c 4d 65 6e 75 20 66 | 69 65 6c 64 73 20 6f 66 |tlMenu f|ields of|
|00005bd0| 20 74 68 65 20 44 43 45 | 2e 20 46 69 6e 61 6c 6c | the DCE|. Finall|
|00005be0| 79 2c 20 73 65 74 20 74 | 68 65 20 64 52 61 6d 42 |y, set t|he dRamB|
|00005bf0| 61 73 65 64 20 62 69 74 | 20 69 6e 20 74 68 65 20 |ased bit| in the |
|00005c00| 64 43 74 6c 46 6c 61 67 | 73 20 66 69 65 6c 64 20 |dCtlFlag|s field |
|00005c10| 6f 66 20 74 68 65 20 44 | 43 45 2e 20 54 68 61 74 |of the D|CE. That|
|00005c20| d5 73 20 61 6c 6c 20 74 | 68 65 72 65 20 69 73 20 |.s all t|here is |
|00005c30| 74 6f 20 69 74 2e 0d 49 | 6d 6d 65 64 69 61 74 65 |to it..I|mmediate|
|00005c40| 20 41 73 79 6e 63 68 72 | 6f 6e 69 63 69 74 79 0d | Asynchr|onicity.|
|00005c50| 54 68 65 20 5f 52 65 61 | 64 2c 20 5f 57 72 69 74 |The _Rea|d, _Writ|
|00005c60| 65 2c 20 5f 53 74 61 74 | 75 73 2c 20 61 6e 64 20 |e, _Stat|us, and |
|00005c70| 5f 43 6f 6e 74 72 6f 6c | 20 74 72 61 70 73 20 64 |_Control| traps d|
|00005c80| 69 66 66 65 72 20 66 72 | 6f 6d 20 5f 4f 70 65 6e |iffer fr|om _Open|
|00005c90| 2c 20 5f 43 6c 6f 73 65 | 2c 20 61 6e 64 20 5f 4b |, _Close|, and _K|
|00005ca0| 69 6c 6c 49 4f 20 69 6e | 20 74 68 61 74 20 61 20 |illIO in| that a |
|00005cb0| 72 65 71 75 65 73 74 20 | 63 61 6e 20 62 65 20 d2 |request |can be .|
|00005cc0| 71 75 65 75 65 64 2c d3 | 20 28 69 2e 65 2e 2c 20 |queued,.| (i.e., |
|00005cd0| 69 6e 73 65 72 74 65 64 | 20 69 6e 74 6f 20 61 20 |inserted| into a |
|00005ce0| 77 61 69 74 69 6e 67 20 | 6c 69 73 74 20 6f 66 20 |waiting |list of |
|00005cf0| 72 65 71 75 65 73 74 73 | 20 66 6f 72 20 74 68 61 |requests| for tha|
|00005d00| 74 20 64 65 76 69 63 65 | 20 64 72 69 76 65 72 29 |t device| driver)|
|00005d10| 2e 20 54 68 69 73 20 71 | 75 65 75 65 20 61 6c 6c |. This q|ueue all|
|00005d20| 6f 77 73 20 72 65 71 75 | 65 73 74 73 20 74 6f 20 |ows requ|ests to |
|00005d30| 62 65 20 73 61 76 65 64 | 20 66 6f 72 20 70 72 6f |be saved| for pro|
|00005d40| 63 65 73 73 69 6e 67 20 | 6c 61 74 65 72 20 69 66 |cessing |later if|
|00005d50| 20 74 68 65 20 64 72 69 | 76 65 72 20 69 73 20 62 | the dri|ver is b|
|00005d60| 75 73 79 20 68 61 6e 64 | 6c 69 6e 67 20 61 6e 6f |usy hand|ling ano|
|00005d70| 74 68 65 72 20 72 65 71 | 75 65 73 74 2e 20 41 73 |ther req|uest. As|
|00005d80| 20 74 68 65 20 64 65 76 | 69 63 65 20 64 72 69 76 | the dev|ice driv|
|00005d90| 65 72 20 66 69 6e 69 73 | 68 65 73 20 73 65 72 76 |er finis|hes serv|
|00005da0| 69 63 69 6e 67 20 65 61 | 63 68 20 72 65 71 75 65 |icing ea|ch reque|
|00005db0| 73 74 2c 20 74 68 65 20 | 6e 65 78 74 20 72 65 71 |st, the |next req|
|00005dc0| 75 65 73 74 20 69 6e 20 | 6c 69 6e 65 20 69 73 20 |uest in |line is |
|00005dd0| 70 61 73 73 65 64 20 74 | 6f 20 74 68 65 20 64 72 |passed t|o the dr|
|00005de0| 69 76 65 72 20 75 6e 74 | 69 6c 20 6e 6f 20 6d 6f |iver unt|il no mo|
|00005df0| 72 65 20 72 65 71 75 65 | 73 74 73 20 72 65 6d 61 |re reque|sts rema|
|00005e00| 69 6e 2e 20 43 61 6c 6c | 73 20 6d 61 64 65 20 74 |in. Call|s made t|
|00005e10| 6f 20 5f 4f 70 65 6e 2c | 20 5f 43 6c 6f 73 65 2c |o _Open,| _Close,|
|00005e20| 20 61 6e 64 20 5f 4b 69 | 6c 6c 49 4f 2c 20 68 6f | and _Ki|llIO, ho|
|00005e30| 77 65 76 65 72 2c 20 6d | 75 73 74 20 62 65 20 68 |wever, m|ust be h|
|00005e40| 61 6e 64 6c 65 64 20 69 | 6d 6d 65 64 69 61 74 65 |andled i|mmediate|
|00005e50| 6c 79 2c 20 73 6f 20 74 | 68 65 79 20 61 72 65 20 |ly, so t|hey are |
|00005e60| 6e 65 76 65 72 20 71 75 | 65 75 65 64 2e 20 54 68 |never qu|eued. Th|
|00005e70| 69 73 20 62 65 68 61 76 | 69 6f 72 20 69 73 20 6e |is behav|ior is n|
|00005e80| 6f 74 20 61 20 70 72 6f | 62 6c 65 6d 20 77 69 74 |ot a pro|blem wit|
|00005e90| 68 20 4f 70 65 6e 20 72 | 65 71 75 65 73 74 73 2c |h Open r|equests,|
|00005ea0| 20 73 69 6e 63 65 20 74 | 68 65 72 65 20 61 72 65 | since t|here are|
|00005eb0| 20 75 73 75 61 6c 6c 79 | 20 6e 6f 20 72 65 71 75 | usually| no requ|
|00005ec0| 65 73 74 73 20 61 6c 72 | 65 61 64 79 20 71 75 65 |ests alr|eady que|
|00005ed0| 75 65 64 2e 20 57 68 61 | 74 20 68 61 70 70 65 6e |ued. Wha|t happen|
|00005ee0| 73 20 77 69 74 68 20 43 | 6c 6f 73 65 20 72 65 71 |s with C|lose req|
|00005ef0| 75 65 73 74 73 20 69 73 | 20 64 65 73 63 72 69 62 |uests is| describ|
|00005f00| 65 64 20 6c 61 74 65 72 | 20 69 6e 20 74 68 69 73 |ed later| in this|
|00005f10| 20 4e 6f 74 65 2e 0d 41 | 73 20 6e 6f 74 65 64 20 | Note..A|s noted |
|00005f20| 65 61 72 6c 69 65 72 2c | 20 74 68 65 73 65 20 74 |earlier,| these t|
|00005f30| 72 61 70 73 20 63 61 6e | 20 62 65 20 6f 70 74 69 |raps can| be opti|
|00005f40| 6f 6e 61 6c 6c 79 20 65 | 78 65 63 75 74 65 64 20 |onally e|xecuted |
|00005f50| 69 6d 6d 65 64 69 61 74 | 65 6c 79 2c 20 61 73 79 |immediat|ely, asy|
|00005f60| 6e 63 68 72 6f 6e 6f 75 | 73 6c 79 2c 20 6f 72 20 |nchronou|sly, or |
|00005f70| 62 6f 74 68 2e 20 4e 6f | 72 6d 61 6c 6c 79 2c 20 |both. No|rmally, |
|00005f80| 77 68 65 6e 20 61 20 74 | 72 61 70 20 69 73 20 65 |when a t|rap is e|
|00005f90| 78 65 63 75 74 65 64 2c | 20 69 74 20 6d 65 61 6e |xecuted,| it mean|
|00005fa0| 73 20 74 68 61 74 20 63 | 6f 6e 74 72 6f 6c 20 73 |s that c|ontrol s|
|00005fb0| 68 6f 75 6c 64 20 6e 6f | 74 20 72 65 74 75 72 6e |hould no|t return|
|00005fc0| 20 74 6f 20 74 68 65 20 | 63 61 6c 6c 65 72 20 75 | to the |caller u|
|00005fd0| 6e 74 69 6c 20 74 68 65 | 20 72 65 71 75 65 73 74 |ntil the| request|
|00005fe0| 20 68 61 73 20 62 65 65 | 6e 20 63 6f 6d 70 6c 65 | has bee|n comple|
|00005ff0| 74 65 64 2e 20 54 68 61 | 74 20 69 73 2c 20 74 68 |ted. Tha|t is, th|
|00006000| 65 20 72 65 71 75 65 73 | 74 65 64 20 74 61 73 6b |e reques|ted task|
|00006010| 20 63 6f 6d 70 6c 65 74 | 65 6c 79 20 66 69 6e 69 | complet|ely fini|
|00006020| 73 68 65 73 20 64 6f 69 | 6e 67 20 77 68 61 74 65 |shes doi|ng whate|
|00006030| 76 65 72 20 77 61 73 20 | 61 73 6b 65 64 20 61 6e |ver was |asked an|
|00006040| 64 20 6e 65 65 64 73 20 | 74 6f 20 64 6f 20 6e 6f |d needs |to do no|
|00006050| 20 66 75 72 74 68 65 72 | 20 61 63 74 69 6f 6e 2e | further| action.|
|00006060| 20 46 6f 72 20 65 78 61 | 6d 70 6c 65 2c 20 61 73 | For exa|mple, as|
|00006070| 73 75 6d 65 20 61 20 5f | 52 65 61 64 20 74 72 61 |sume a _|Read tra|
|00006080| 70 20 69 73 20 63 61 6c | 6c 65 64 20 66 6f 72 20 |p is cal|led for |
|00006090| 61 20 73 65 72 69 61 6c | 20 64 72 69 76 65 72 2e |a serial| driver.|
|000060a0| 20 49 66 20 63 61 6c 6c | 65 64 20 6e 6f 72 6d 61 | If call|ed norma|
|000060b0| 6c 6c 79 2c 20 63 6f 6e | 74 72 6f 6c 20 77 6f 75 |lly, con|trol wou|
|000060c0| 6c 64 20 6e 6f 74 20 72 | 65 74 75 72 6e 20 74 6f |ld not r|eturn to|
|000060d0| 20 74 68 65 20 63 61 6c | 6c 65 72 20 75 6e 74 69 | the cal|ler unti|
|000060e0| 6c 20 61 20 63 68 61 72 | 61 63 74 65 72 20 77 61 |l a char|acter wa|
|000060f0| 73 20 72 65 63 65 69 76 | 65 64 2e 0d 41 6e 20 61 |s receiv|ed..An a|
|00006100| 73 79 6e 63 68 72 6f 6e | 6f 75 73 6c 79 20 65 78 |synchron|ously ex|
|00006110| 65 63 75 74 65 64 20 74 | 72 61 70 20 73 68 6f 75 |ecuted t|rap shou|
|00006120| 6c 64 20 72 65 74 75 72 | 6e 20 74 6f 20 74 68 65 |ld retur|n to the|
|00006130| 20 63 61 6c 6c 65 72 20 | 61 73 20 73 6f 6f 6e 20 | caller |as soon |
|00006140| 61 73 20 70 6f 73 73 69 | 62 6c 65 2c 20 65 76 65 |as possi|ble, eve|
|00006150| 6e 20 69 66 20 74 68 65 | 20 72 65 71 75 65 73 74 |n if the| request|
|00006160| 20 63 61 6e 6e 6f 74 20 | 62 65 20 63 6f 6d 70 6c | cannot |be compl|
|00006170| 65 74 65 64 20 62 65 66 | 6f 72 65 20 72 65 74 75 |eted bef|ore retu|
|00006180| 72 6e 69 6e 67 2e 20 49 | 6e 20 74 68 65 20 70 72 |rning. I|n the pr|
|00006190| 65 76 69 6f 75 73 20 65 | 78 61 6d 70 6c 65 2c 20 |evious e|xample, |
|000061a0| 69 66 20 5f 52 65 61 64 | 20 77 65 72 65 20 65 78 |if _Read| were ex|
|000061b0| 65 63 75 74 65 64 20 61 | 73 79 6e 63 68 72 6f 6e |ecuted a|synchron|
|000061c0| 6f 75 73 6c 79 2c 20 69 | 74 20 77 6f 75 6c 64 20 |ously, i|t would |
|000061d0| 72 65 74 75 72 6e 20 63 | 6f 6e 74 72 6f 6c 20 61 |return c|ontrol a|
|000061e0| 73 20 73 6f 6f 6e 20 61 | 73 20 74 68 65 20 72 65 |s soon a|s the re|
|000061f0| 71 75 65 73 74 20 77 61 | 73 20 6e 6f 74 65 64 20 |quest wa|s noted |
|00006200| 72 61 74 68 65 72 20 74 | 68 61 6e 20 77 61 69 74 |rather t|han wait|
|00006210| 69 6e 67 20 75 6e 74 69 | 6c 20 61 20 63 68 61 72 |ing unti|l a char|
|00006220| 61 63 74 65 72 20 77 61 | 73 20 72 65 63 65 69 76 |acter wa|s receiv|
|00006230| 65 64 2e 20 57 68 65 6e | 20 61 20 63 68 61 72 61 |ed. When| a chara|
|00006240| 63 74 65 72 20 66 69 6e | 61 6c 6c 79 20 77 61 73 |cter fin|ally was|
|00006250| 20 72 65 63 65 69 76 65 | 64 2c 20 74 68 65 20 69 | receive|d, the i|
|00006260| 6f 52 65 73 75 6c 74 20 | 6f 66 20 74 68 65 20 70 |oResult |of the p|
|00006270| 61 72 61 6d 65 74 65 72 | 20 62 6c 6f 63 6b 20 77 |arameter| block w|
|00006280| 6f 75 6c 64 20 72 65 66 | 6c 65 63 74 20 74 68 61 |ould ref|lect tha|
|00006290| 74 20 66 61 63 74 2c 20 | 61 6e 64 20 61 6e 79 20 |t fact, |and any |
|000062a0| 69 6f 43 6f 6d 70 6c 65 | 74 69 6f 6e 20 72 6f 75 |ioComple|tion rou|
|000062b0| 74 69 6e 65 20 77 6f 75 | 6c 64 20 62 65 20 65 78 |tine wou|ld be ex|
|000062c0| 65 63 75 74 65 64 2e 0d | 57 68 65 6e 20 61 20 74 |ecuted..|When a t|
|000062d0| 72 61 70 20 69 73 20 65 | 78 65 63 75 74 65 64 20 |rap is e|xecuted |
|000062e0| 69 6d 6d 65 64 69 61 74 | 65 6c 79 2c 20 69 74 20 |immediat|ely, it |
|000062f0| 6d 65 61 6e 73 20 74 68 | 61 74 20 74 68 65 20 72 |means th|at the r|
|00006300| 65 71 75 65 73 74 20 69 | 73 20 6e 6f 74 20 71 75 |equest i|s not qu|
|00006310| 65 75 65 64 2c 20 62 75 | 74 20 72 61 74 68 65 72 |eued, bu|t rather|
|00006320| 20 73 65 6e 74 20 69 6d | 6d 65 64 69 61 74 65 6c | sent im|mediatel|
|00006330| 79 20 74 6f 20 74 68 65 | 20 64 72 69 76 65 72 2c |y to the| driver,|
|00006340| 20 77 68 65 74 68 65 72 | 20 6f 72 20 6e 6f 74 20 | whether| or not |
|00006350| 69 74 20 69 73 20 62 75 | 73 79 20 68 61 6e 64 6c |it is bu|sy handl|
|00006360| 69 6e 67 20 61 6e 6f 74 | 68 65 72 20 72 65 71 75 |ing anot|her requ|
|00006370| 65 73 74 2e 20 49 6d 6d | 65 64 69 61 74 65 20 72 |est. Imm|ediate r|
|00006380| 65 71 75 65 73 74 73 20 | 61 72 65 20 74 79 70 69 |equests |are typi|
|00006390| 63 61 6c 6c 79 20 6e 6f | 74 20 49 2f 4f 2d 72 65 |cally no|t I/O-re|
|000063a0| 6c 61 74 65 64 20 69 6e | 20 6e 61 74 75 72 65 2e |lated in| nature.|
|000063b0| 20 49 66 20 74 68 65 20 | 65 78 61 6d 70 6c 65 20 | If the |example |
|000063c0| 63 61 6c 6c 20 77 65 72 | 65 20 74 6f 20 68 61 76 |call wer|e to hav|
|000063d0| 65 20 62 65 65 6e 20 65 | 78 65 63 75 74 65 64 20 |e been e|xecuted |
|000063e0| 69 6d 6d 65 64 69 61 74 | 65 6c 79 2c 20 69 74 20 |immediat|ely, it |
|000063f0| 69 73 20 6e 6f 74 20 63 | 6c 65 61 72 20 77 68 61 |is not c|lear wha|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.